I have a feature class with filed DXF_TEXT and FZONE_CODE i would like to search for certain attributes in the DXF_TEXT field and update the FZONE_CODE but i am not sure what the best was to do it. i have tried the following but i can only do one at a time.
I would like to add more to the if row[0]== "R32558011","R32747010", "R32842", "R32839":
How can i search for "R32558011","R32747010", "R32842", "R32839" and update those select FZONE_CODE to " " (blank)?
Thanks.
with arcpy.da.UpdateCursor("C:\TEMP\FZon2", ['DXF_TEXT', 'FZONE_CODE']) as cursor:
for row in cursor:
if row[0] == "R32558011": #"R32747010", "R32842", "R32839":
row[1] = " "
cursor.updateRow(row)
Solved! Go to Solution.
if row[0] in [ blah, another, something]:
row[1] = " "
else:
do something else
if row[0] in [ blah, another, something]:
row[1] = " "
else:
do something else
This should update all of them at once. You were close!
with arcpy.da.UpdateCursor(r"C:\TEMP\FZon2", ['DXF_TEXT','FZONE_CODE']) as cursor:
... for row in cursor:
... if row[0] == "R32558011" or row[0] == "R32747010" or row[0] == "R32842" or row[0] == "R32839":
... row[1] = ''
... cursor.updateRow(row)
Regards,
Alex