I need a small code in python that will delete records that have empty value in a specific field of the layer. The name of the feature class is WCSCustomer and the name of the field is GROUTE
I found code to strip all non printables on StackOverflow.
def stripper(s): return "".join(i for i in s if ord(i)<127 and ord(i)>32) fc = r"C:\tmp\Test.gdb\WCSCustomer" field = "GROUTE" with arcpy.da.UpdateCursor(fc, field) as rows: for row in rows: try: val = stripper(s) except: val = row[0] if val in ["", None]: rows.deleteRow(row)
with the unicode encoding cavaet is people move closer to python 3. Make sure you read that full thread, it is interesting... a "space" is much like "nothing"..it comes in many forms