我有以下句子:
Graft Concepts has partnered with\u00a0several sites\u00a0to offer customization options for backplates, so customers will be able to design their own with\u00a0
我想摆脱所有“\ u00a0”的实例,无论它们是否与其他单词相关联,例如“与\ u00a0several”
如何使用python的正则表达式执行此操作?我已经尝试过使用re.compile()和re.findall()进行实验,但是我无法使用它?
感谢。
答案 0 :(得分:6)
您可以使用.replace
:
s = s.replace('\\u00a0', ' ')
答案 1 :(得分:0)
这适用于Python 2:
import re
st='''Graft Concepts has partnered with\u00a0several sites\u00a0to offer customization options for backplates, so customers will be able to design their own with\u00a0'''
st=re.sub(ur'\\u00a0','',st,re.UNICODE)
这在Python 3下:
st=re.sub(u'\\u00a0','',st,re.UNICODE)