I am trying to fill specific rows of data that have no data in them with a combination of data from other fields within the attribute table. I'm currently using the UpdateCursor command and I have this code worked out and it runs with no errors but, nothing happens.... The rows don't fill in with the data.
with arcpy.da.UpdateCursor("Export_Output", ["SYM", "ZONE_SUBTY","Label","FLD_ZONE"]) as rows:
... for row in rows:
... if row == "":
... row = "row“-”row"
... row = "SPECIAL"
if row is None: row = str(row - row" # assuming row and row]1] are numeric
I am assuming the noted comment on line 2.
Your incarnation of line 1 won't work unless there is a string in it. If the field contains <null> values, then you have to test for None
Ryan- with your keen interest in arcpy, here is a little tip when working with cursors: you can create a variable to hold your list of attribute field names and get extra style points for it:
fields = ['SYM', 'ZONE_SUBTY', 'Label', 'FLD_ZONE'] with arcpy.da.UpdateCursor("Export_Output", fields) as rows: ... for row in rows: ... ...
BTW, Dan's str() method is missing the closing paren- he did that just to see if I'd notice....
good catch... I will leave it to see if others catch it
Ryan Phillips, for future reference, the Python place/space is where ArcPy questions usually get asked.