【发布时间】:2021-02-14 04:04:35
【问题描述】:
我想要处理的文本文件中有一些字符串。我尝试了许多正则表达式模式,但没有一个对我有用。
someone can tell/figure
a/the squeaky wheel gets the grease/oil
accounts for (someone or something)
that's/there's (something/someone) for you
我需要以下字符串组合:
someone can tell
someone can figure
a squeaky wheel gets the grease
a squeaky wheel gets the oil
the squeaky wheel gets the grease
the squeaky wheel gets the oil
accounts for someone
accounts for something
that's something for you
that's someone for you
there's something for you
there's someone for you
【问题讨论】:
-
请展示您的尝试并详细解释它是如何失败的。
-
我有一个类似的问题,我想使用
/或or分割字符串,然后将它们与前面或相应的文本连接起来 -
@Mujtaba 这让你很可能有相同的家庭作业并且在同一个班级。
-
它需要对字符串的其余部分进行大量工作(如果它在句子的开头/结尾,如果它在空格或括号之间等),以便您获得最后的句子正确
标签: python regex string list combinations