擅长:python、mysql、java
<p>像这样的</p>
<pre><code>import re
def foo(string):
return re.findall(r'\s*([a-zA-Z0-9 -,\']+[\.!\?]+)\s*', string)
</code></pre>
<p>将返回一个“句子”数组。修改regex以适应可能看到的字符类型</p>
<p>例如</p>
<pre><code>string = "This isn't what I had in mind, but it will do. WHAT!!? OK, OK stop typing already."
re.findall(r'\s*([a-zA-Z0-9 -,\']+[\.!\?]+)\s*', string)
["This isn't what I had in mind, but it will do.", 'WHAT!!?', 'OK, OK stop typing already.']
</code></pre>