import arcpy, sys, os, traceback from arcpy import env env.workspace = r"C:\Users\Drew\Desktop\Montpelier\PythonTest\PythonGDB.gdb" env.overwriteOutput = 1 fc = "dshline_Project" field = ["Layer"] valueList = [] #Use search cursor to aquire a list of unique values with arcpy.da.SearchCursor(fc, field) as cursor: for row in cursor: valueList.append(row[0]) uniqueSet = set(valueList) uniqueList = list(uniqueSet) uniqueList.sort() del cursor count = 0 name = uniqueList[count] if count < 34: outputname = env.workspace + os.sep + name arcpy.MakeFeatureLayer_management (fc, "layer") arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION", "Layer = " + name) arcpy.CopyFeatures_management("layer", outputname) count += 1 name = uniqueList[count] else: print "Done"
while count <= lencount - 1: # the rest of your code # so that 33 - 1 = 32, the upper index 0-based limit
count = 0 while count < lencount: name = uniqueList[count] arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION", "Layer = '" + name + "'") # etc., etc. count += 1 print 'done!'
for count in range(lencount): name = uniqueList[count] arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION", "Layer = '" + name + "'") # etc., etc. print 'done!'
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.