句子:
'I understood that that morning did not work out for her but I would still like to to make an appointment with her. I mean if she does great lashes and it\'s just this one little hiccup in the beginning it\'s well worth it as far as I\'m concerned.'
如何删除转义字符以清除数据?
答案 0 :(得分:0)
我想,一个简单的re.sub
可能会起作用:
import re
string = '''
I understood that that morning did not work out for her but I would still like to to make an appointment with her. I mean if she does great lashes and it\'s just this one little hiccup in the beginning it\'s well worth it as far as I\'m concerned.
'''
expression = r'\\'
print(re.sub(expression, '', string))
我了解到那天早上对她没有帮助,但我会 仍然想和她约会。我的意思是如果她这样做 很好的睫毛,一开始只是这个小小的打cup 就我而言,这非常值得。
答案 1 :(得分:0)
正确的答案在@ bryan-oakley的评论中:没什么可做的。
作为测试:
s = 'I understood that that morning did not work out for her but I would still like to to make an appointment with her. I mean if she does great lashes and it\'s just this one little hiccup in the beginning it\'s well worth it as far as I\'m concerned.'
assert len(s) == len(s.replace('\'', "'")) # passes
assert s == s.replace('\'', "'") # passes