相关疑难解决方法(0)

替换2个字符串python之间的所有文本

让我们说:

a = r''' Example
This is a very annoying string
that takes up multiple lines
and h@s a// kind{s} of stupid symbols in it
ok String'''
Run Code Online (Sandbox Code Playgroud)

我需要一种方法在"This"和"ok"之间进行替换(或者只是删除)和文本,这样当我调用它时,现在等于:

a = "Example String"
Run Code Online (Sandbox Code Playgroud)

我找不到任何似乎有效的通配符.任何帮助深表感谢.

python

12
推荐指数
4
解决办法
2万
查看次数

标签 统计

python ×1