I have the following string:
word = u'Buffalo,xa0ILxa060625'
I don't want the "xa0" in there. How can I get rid of it? The string I want is:
word = 'Buffalo, IL 06025
The most robust way would be to use the unidecode module to convert all non-ASCII characters to their closest ASCII equivalent automatically.
unidecode
The character xa0 (not xa as you stated) is a NO-BREAK SPACE, and the closest ASCII equivalent would of course be a regular space.
xa0
xa
import unidecode word = unidecode.unidecode(word)
2.1m questions
2.1m answers
60 comments
57.0k users