<p>根据<a href="http://docs.python.org/2/library/stdtypes.html#string-methods" rel="nofollow">Python documentation</a>:</p>
<blockquote>
<p>str.endswith(suffix[, start[, end]])</p>
<p>Return True if the string ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. Withoptional end, stop comparing at that position.</p>
<p>Changed in version 2.5: Accept tuples as suffix.</p>
</blockquote>
<p>下面的代码应该返回<code>True</code>,但是在Python 2.7.3中它返回<code>False</code>:</p>
<pre><code>"hello-".endswith(('.', ',', ':', ';', '-' '?', '!'))
</code></pre>
<p>似乎<code>str.endswith()</code>忽略了第四个元组元素之外的任何内容:</p>
^{pr2}$
<p>我有没有发现一个虫子,或者我遗漏了什么?在</p>