Select to view content in your preferred language

Arcpy Search Cursor Looping through columns to search for specific values

399
1
11-04-2021 12:17 PM
ManoharDevGis
New Contributor

I am comparing the data in Two shape File Ex: Existing.Shp and UpdatedRecently.shp. Existing.shp files has 3110 Records and Updated.shp has 410 records total and 110 duplicated records from Existing.shp. Logic: Location and Date Field was taken using SearchCursor and parsing in Updated.shp for finding and removing Duplicate records[110 Records].The remaining 300 records has to added in Existing.shp file.

 

Error: For Loop- It's not resetting to First Row.In the debug session. The last record is retained in the Loop

 

for Kilroy in Trows://Last record of For loop first execution Retained
if tdy == Kilroy[4]:
print(tdy)
else:
print("Inner Else")
continue

 

Tags (1)
0 Kudos
1 Reply
JoeBorgione
MVP Emeritus

A few of suggestions before going any further.  First; it's your best interest to leave shapefiles behind and use file geodatabase feature classes instead. Second; provide the rest of you code, as the little snippet provided isn't enough to grasp the situation. Third; be sure you are using the arcpy.da.SearchCursor and not the old style cursors.

That should just about do it....