Good Afternoon:
I believe what I am asking if an elementary level Python code. However, my intention is to run thru a File GDB Feature Class to identify a value from a different field in the same row. Basically, looking for the User to add the value from the field "TWACS_NUMBER" and use the SearchCursor feature to identify the value in the XFMR_BANK_ID field of the same row. I have figured out the User Input portion of the script, but the SearchCursor feature is giving me a hard time with too many example online. Any starting points would help.
Thank You
Solved! Go to Solution.
A simple search cursor example:
fc = 'feature or table to search'
fields = ['TWACS_NUMBER', 'XFMR_BANK_ID']
where = "TWACS_NUMBER = 'some value'" # if string wrap value in single quotes; if number then no single quotes
with arcpy.da.SearchCursor(fc, fields, where) as cursor:
for row in cursor:
print('TWACS_NUMBER: {0} XFMR_BANK_ID: {1}'.format(row[0], row[1]))
A simple search cursor example:
fc = 'feature or table to search'
fields = ['TWACS_NUMBER', 'XFMR_BANK_ID']
where = "TWACS_NUMBER = 'some value'" # if string wrap value in single quotes; if number then no single quotes
with arcpy.da.SearchCursor(fc, fields, where) as cursor:
for row in cursor:
print('TWACS_NUMBER: {0} XFMR_BANK_ID: {1}'.format(row[0], row[1]))