擅长:python、mysql、java
<p>你可以用正则表达式匹配这两个词</p>
<pre><code>import re
word_one = "networks"
word_two = "researchers"
string = "There are thousands of types of specific networks proposed by researchers as modifications or tweaks to existing models"
result = re.search(f'{word_one}(.+?){word_two}', string)
print(result.group(1))
</code></pre>