I have the following string:
word = u\'Buffalo,\\xa0IL\\xa060625\'
I don\'t want the \"\\xa0\" in there. How can I get rid of it? The st
If you know for sure that is the only character you don't want, you can .replace
it:
>>> word.replace(u'\xa0', ' ')
u'Buffalo, IL 60625'
If you need to handle all non-ascii characters, encoding and replacing bad characters might be a good start...:
>>> word.encode('ascii', 'replace')
'Buffalo,?IL?60625'