我的csv文件中的文本被读取为原始文本。它包含“它”而不是它。我该如何清洁

问题描述 投票:0回答:1

sentence =“我知道那天早上没有为她工作,但我仍然想和她约个约会。我的意思是,如果她睫毛浓密,那只是一开始的小毛病就我而言,这是值得的。”如何删除转义字符以清除数据?

python regex nlp sentiment-analysis rawstring
1个回答
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就我而言,这是值得的。

© www.soinside.com 2019 - 2024. All rights reserved.