AnsweredAssumed Answered

Indexing using a SearchCursor

Question asked by LarryAdgate on Nov 2, 2018
Latest reply on Nov 2, 2018 by Dan_Patterson

I would really appreciate it if someone could help me with this: Thank You
#My Two "GWO" fields in set1 and set2 are a bunch of numbers in a Feature-class text field.
#I need to index the last four numbers in both Set1 & Set2 but its just not working as expected.....Please help

#A typical GWO number is 90-2090.  I need the 2090 


import arcpy

fc1 = "C:\\wLateralLine"
fc2 = "C:\\wMain"


set1 = set(r[0] for r in arcpy.da.SearchCursor(fc1,["GWO"][-4:]))
set2 = set(r[0] for r in arcpy.da.SearchCursor(fc2,["GWO"][-4:]))


print "The My four GWO numbers : {}".format(", ".join(sorted(set1-set2)))