擅长:python、mysql、java
<p>你确实误用了<code>and</code>操作符,我建议你阅读这篇文章来理解你的错误:<a href="https://stackoverflow.com/questions/19213535/using-and-and-or-operator-with-python-strings">Using "and" and "or" operator with Python strings</a></p>
<p>您应该对第一个结果应用第二个<code>sub</code>,如下所示:</p>
<pre><code>replaces = daysRegex.sub("<day>", monthsRegex.sub("<month>", text))
</code></pre>
<p>你会得到正确的输出</p>