擅长:python、mysql、java
<p>您可以使用<a href="http://ttps://docs.python.org/3/library/string.html#string.split" rel="nofollow noreferrer"><strong>split()</strong></a>和is<strong><a href="https://docs.python.org/3/library/stdtypes.html#str.isalpha" rel="nofollow noreferrer">isalpha()</a></strong>来获取只有字母字符且至少有一个字符的单词列表。在</p>
<pre><code>>>> sentence = "asdf@gmail.com said: I've taken 2 reports to the boss"
>>> alpha_words = [word for word in sentence.split() if word.isalpha()]
>>> print(alpha_words)
['taken', 'reports', 'to', 'the', 'boss']
</code></pre>
<p>然后可以使用<a href="https://docs.python.org/3/library/string.html#string.join" rel="nofollow noreferrer"><strong>join()</strong></a>将列表变成一个字符串:</p>
^{pr2}$