Tag Info

Hot answers tagged

4

You could approach it a bit differently: import arcpy import os arcpy.env.workspace = 'c:\temp' fcs = [fc for fc in arcpy.ListFeatureClasses() if fc.startswith('X_') or os.path.splitext(fc)[0].endswith('_Y')]


2

In your code try replacing this: for row in searchC: A = [x.split('Point') for x in row[:-1] ] with this: for row in searchC: print row[:-1] A = [x.split('Point') for x in row[:-1] ] and I think you will see that row[:-1] is returning a list of integers that you are iterating and then cannot split individually.


2

Your rename won't work because you are replacing the extension with nothing. Use os.path.splitext() to remove the extension and then you can add it back. polyFCs = arcpy.ListFeatureClasses("*_Value.shp", "POLYGON") field = "Area" #Don't need to keep redefining this each loop. field = "SHAPE@AREA" #Or, use this to grab the area of the feature. for polyf ...


1

Try this for your cursor (as I stated your cursor field parameter needs to be a string or a list and using the da.cursor use row[0] for getting the value): with arcpy.da.SearchCursor(polyf, field) as cursor: for row in cursor: if row[0] > X: # your rename here


1

Add the two together, they are just lists. FCS = arcpy.ListFeatureClasses("X_*") + arcpy.ListFeatureClasses("*_Y") To eliminate duplicates: FCS = set(arcpy.ListFeatureClasses("X_*") + arcpy.ListFeatureClasses("*_Y"))



Only top voted, non community-wiki answers of a minimum length are eligible