擅长:python、mysql、java
<p>使用正则表达式,尤其是
<a href="https://docs.python.org/3/library/re.html#re.sub" rel="nofollow noreferrer">^{<cd1>}</a>,您可以尝试:</p>
<pre><code>import re
l1 = ['John', 'London', '219980']
s1 = "This is John Clay. He is from London with 219980"
p = '|'.join(l1) # pattern to replace
re.sub(p, '', s1)
# 'This is Clay. He is from with '
</code></pre>