Python:文字列のxa 0を削除
463 ワード
\xa0 is actually non-breaking space in Latin1 (ISO 8859-1), also chr(160). You should replace it with a space.
string = string.replace(u'\xa0', u' ')
When .encode('utf-8'), it will encode the unicode to utf-8, that means every unicode could be represented by 1 to 4 bytes. For this case,\xa0 is represented by 2 bytes\xc2\xa0.
https://stackoverflow.com/questions/10993612/python-removing-xa0-from-string