I have three shapefiles that I need to perform a function on. Can I nest SearchCursors or is there a way to run an arcpy.SearchCursor through a list of feature classes/shapefiles? something like below. I am trying not to have 100 lines of code. The files share field names so "fieldone" exists in all three shapefiles.

with arcpy.SearchCursor(featureclassList,("fieldone","fieldtwo") as cursor:
    for x in cursor:
with arcpy.SearchCursor(shapefile1,shapefile2,("fieldone","fieldtwo") as cursor:
    for x in cursor:
       (perform math expression)

  • What do you want to do with the result of your function?
    – Bera
    Commented Nov 25, 2021 at 6:15

1 Answer 1


No. The cursor only accepts 1 feature class.

Using your example, just wrap the cursor in the loop and pass in the feature class one at a time.

for fc in featureclassList:
    with arcpy.SearchCursor(fc,("fieldone","fieldtwo") as cursor:
        for x in cursor:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.