擅长:python、mysql、java
<p>你应该做<code>list[44:49]</code>,而不是<code>list[44:5]</code>。
通常,当您想在a+1th项之后(包括a+1th项)获取5个项时,您需要<code>L[a, a+5]</code>。
“通常”意味着有更灵活的方法可以这样做:请参见扩展切片:<a href="http://docs.python.org/release/2.3/whatsnew/section-slices.html" rel="noreferrer">http://docs.python.org/release/2.3/whatsnew/section-slices.html</a>。</p>
<p>也不要使用<code>list</code>作为列表名。它覆盖<code>list()</code>。</p>