I would like to remove a comma from a string in Python. This is the code that I am using:
next_column = unicode(my_value)
next_column.replace(",", " ")
next_column.translate(dict([[ord(char), u''] for char in u',']))
next_column.translate(dict([[ord(char), None] for char in u',']))
if my_key == "practice_name":
nc = str(next_column)
nc.replace(",", " ")
nc.replace(',', " ")
pprint(nc)
The pprint shows:
'Phoenix Electronics, LLC'
The comma is still there.
"my_value" comes from a Postgres database, an old legacy app where the company failed to check the encoding of what was going into the database.
I don't know if this is a code issue or an encoding issue. Does anyone have any suggestions?