📜  python remove \xa0 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:53.822000             🧑  作者: Mango

代码示例1
# credit in the source link

import unicodedata

str_hard_space='17\xa0kg on 23rd\xa0June 2021'
print(str_hard_space)
xa=u'\xa0'

if xa in str_hard_space:
    print("xa0 is Found!")
else:
    print("xa0 is not Found!")

# this is the command you are looking for
new_str = unicodedata.normalize("NFKD", str_hard_space)
print (new_str)
if xa in new_str:
    print("xa0 is Found!")
else:
    print("xa0 is not Found!")