Hot answers tagged arcpy
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).endswith('_Y')]
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.
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 ...
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 for getting the value): with arcpy.da.SearchCursor(polyf, field) as cursor: for row in cursor: if row > X: # your rename here
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