I have a feature class that has a field of unique ID numbers. I would like to create an array of these numbers so I can loop over them in ArcPy. Any ideas?
If you have Arc 10.1 or above, I'd use an arcpy.da cursor. Also specify just the field(s) you want.
myLayer = 'YourLayer' myField = 'YourField' myList = [row for row in arcpy.da.SearchCursor(myLayer, myField)]
Use a cursor to add to a list. The use the list for whatever.
myList =  rows = arcpy.SearchCursor(YOURLAYER) for row in rows: if row.YOURFIELD not in myList: myList.append(row.YOURFIELD) del rows del row