擅长:python、mysql、java
<blockquote>
<p>or am I missing something?</p>
</blockquote>
<p>元组中的<code>';'</code>后面缺少逗号:</p>
<pre><code>>>> "hello;".endswith(('.', ',', ':', '-', ';' '?', '!'))
# ^
# comma missing
False
</code></pre>
<p>因此,<code>;</code>和{<cd3>}被连接起来。因此,对于这种情况,以<code>;?</code>结尾的字符串将返回<code>True</code>:</p>
^{pr2}$
<p>添加逗号后,它将按预期工作:</p>
<pre><code>>>> "hello;".endswith(('.', ',', ':', '-', ';', '?', '!'))
True
</code></pre>