Select to view content in your preferred language

Searchcursor Inside UpdateCursor

906
2
Jump to solution
05-22-2022 04:02 AM
AbhishekOjha
New Contributor

Hi, I am new to arcpy and trying to automate one of my daily task.

i want to use Searchcursor Inside UpdateCursor for multiple fc look through. I want to update MPK field form CP fc based on Mains and Service fc. please help.

AbhishekOjha_0-1653217093268.png

Thank you in advance.

 

0 Kudos
1 Solution

Accepted Solutions
Luke_Pinner
MVP Regular Contributor

Don't nest Cursors. Build a dict with a da.SearchCursor, then refer to that dict in your da.UpdateCursor loop. Here are plenty of examples:

Turbo Charging Data Manipulation with Python Cursors and Dictionaries

 

View solution in original post

2 Replies
Luke_Pinner
MVP Regular Contributor

Don't nest Cursors. Build a dict with a da.SearchCursor, then refer to that dict in your da.UpdateCursor loop. Here are plenty of examples:

Turbo Charging Data Manipulation with Python Cursors and Dictionaries

 

AbhishekOjha
New Contributor

Thank you, I'll try that.

0 Kudos