擅长:python、mysql、java
<p>您正在从列表中删除项。如果从包含10个项目的<code>l1</code>开始,那么k将从0变为9,但是如果从<code>l1</code>中删除一个项目,那么<code>l1[9]</code>就不再存在。你知道吗</p>
<p>我还认为<code>if "-" in (l1[-k] or l1[-k-1]):</code>是在测试<code>"-"</code>是否在<code>l1[-k]</code>和<code>l1[-k-1]</code>的逻辑或中,我认为这不是你想要的?你知道吗</p>