如何使用regexpython3从文本中删除“”

2024-03-29 12:49:22 发布

您现在位置:Python中文网/ 问答频道 /正文

所以,我有一个文本字符串,我想从中删除“”。你知道吗

这是我的文本字符串:

string= 'Sample this is a string text with "ut" '

下面是我使用regex表达式想要的输出:

string= 'Sample this is a string text with ut'

这是我的总体代码:

import re
string= 'Sample this is a string text with "ut" '
re.sub('" "', '', string)

输出只显示字符串中的精确文本,没有任何更改。有什么建议吗?你知道吗


Tags: sample字符串代码text文本importrestring