AnsweredAssumed Answered

arcpy.FeatureClassToFeatureClass_conversion()

Question asked by jpilbeam on Mar 5, 2018
Latest reply on Mar 7, 2018 by jpilbeam

I'm wondering how to have a single parameter in the arcpy.FeatureClassToFeatureClass_conversion() function instead of repeating the block of code for two variables (Address_Points and Street), basically. 

 

From what I understand, the way this script is set up now, the outer loop prints once for each variable. Then it prints once for each variable again in the inner loop. It runs as I expect, namely with no errors and saves the two feature classes as shapefiles in the Test folder.

 

import arcpy
arcpy.env.overwriteOutput = True

# variables
infeatures = [r'fullpath\gisedit.DBO.Street',
               r'fullpath\gisedit.DBO.Address_Points']
outpath = r'fullpath\GISstaff\Jared\Test'
outfeatures = ['WillCounty_Streets', 'WillCounty_AddressPoints']

# loop and print feature classes
for infs in infeatures:
    print infs
    for otfs in outfeatures:
        print otfs
        arcpy.FeatureClassToFeatureClass_conversion(infs,outpath,otfs)

Result:

>>> fullpath\gisedit.DBO.Street
WillCounty_Streets
WillCounty_AddressPoints
fullpath\gisedit.DBO.Address_Points
WillCounty_Streets
WillCounty_AddressPoints

 

How do I get the print out to look like this?

WillCounty_Streets
WillCounty_AddressPoints

Outcomes