<p>我想去掉一串标点符号,结果用了</p>
<pre><code>re.findall(r"[\w]+|[^\s\w]", text)
</code></pre>
<p>它工作得很好,确实解决了我的问题。我不明白的是括号内的细节和整个模式。<code>r"[\w]+|[^\s\w]"</code>到底是什么意思?我在<a href="https://www.cnpython.com/book/596" class="inner-link">python标准库</a>中找到它,它说:</p>
^{pr2}$
<blockquote>
<p>Return all non-overlapping matches of pattern in string, as a list of
strings. The string is scanned left-to-right, and matches are returned
in the order found. If one or more groups are present in the pattern,
return a list of groups; this will be a list of tuples if the pattern
has more than one group. Empty matches are included in the result
unless they touch the beginning of another match.</p>
</blockquote>
<p>我不确定我是否明白这一点,而且澄清听起来有点模糊。有谁能告诉我这个上下文中的模式是什么意思,它是如何在findall()方法中定义的?在</p>