I have some code that is intended to remove spaces from some data I'm ingesting from a group of shapefiles into a number of feature classes. The malformed data consistently looks like this:
and I want to make it look like:
Simple, right? So the code block goes:
with arcpy.da.UpdateCursor(fc, 'FIELD') as cursor: for rows in cursor: if rows: firstValue = rows secondValue = firstValue.replace(' ', '') rows = secondValue[:13] #this is because some rows have more than 13 characters cursor.updateRow(rows)
I've inserted print statements and it is getting into the loop, but the .replace method is not doing anything.
I've also tried swapping out .replace() with
secondValue = (firstValue[:11] + firstValue[12:])
and no dice there either.
The print statements show:
through the entire loop - neither replace() nor concatenation is having any effect.
Is it possible that this is not actually a space character? Could this be a tab value or something which is causing this code to fail?