AnsweredAssumed Answered

Python not recognizing special character in string

Question asked by IMakeNiceMaps on Oct 10, 2019
Latest reply on Nov 21, 2019 by IMakeNiceMaps

I am using an update cursor to update one field based on the content of another. I can't get part of the Python script I've written to properly handle the underscore special character that is present in my data. I think I need to do something to ensure the string is read as unicode and not ascii, but I cannot figure out how to do this when referring to an index value.  Can someone help?  (Below is not the real script but it is the part that I am having trouble with.)

 

with arcpy.da.UpdateCursor (in_table="Test", field_names=["CATS", "DOGS"]) as cursor:
    for row in cursor:
        if str(row[0].upper()) not in ["PIZZA", "N_A"]:
            row[1] = 12345
        cursor.updateRow(row)
del cursor, row

Outcomes