Python:删除字符串中的 \ xa0

 

\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

你可能感兴趣的:(python)