AnsweredAssumed Answered

loop terminates

Question asked by tl_chojnacki on Sep 21, 2017
Latest reply on Sep 26, 2017 by CDow-esristaff


I am trying to perform some editing on features that have the same attribute value  as features of a different feature class. So I tried this:


field0 = 'SKMS_tor'
field1 = 'SKMS'
cursor0 = arcpy.da.SearchCursor(fc0, field0)
cursor1 = arcpy.da.SearchCursor(fc1, field1)

for row0 in cursor0:
    for row1 in cursor1:

        if row0 == row1:

            do do editing


            skip editing


I works, but only for the first round. Then it stops and does not proceed to the second feature in the feature class. Not sure what is wrong with this script.


I tested the same syntax on a different example:


q = ['a1', 'a2', 'a3']
w = ['a3', 'a1', 'b2']
for x in q:
    for y in w:
        if x == y:
            print x, " YES ", y
            print x, " NO ", y


and it works fine.


To my novice eye there is no difference in both scripts except the use arcpy.da.SearchCursor(). Can this be a problem? if not, what else?


Thanks for help.