This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author py_ok
Recipients py_ok, steven.daprano
Date 2021-08-19.04:57:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
Yes,I remember that my error in Java,like you say it`s skiped

发件人: "Python tracker"<;; 
发送时间: 2021年8月19日(星期四) 中午12:53
收件人: "海"<;; 
主题: [issue44952] list need to filter again because the continue empty str value?

Steven D'Aprano <; added the comment:

To understand why your code doesn't work, run this:

items = ['a', '', 'b', '', 'c', '', 'd', '', 'e', '']


for index, item in enumerate(items):
&nbsp;&nbsp;&nbsp; print(index, repr(item), items)
&nbsp;&nbsp;&nbsp; if item == '':
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; items.remove('')

When you remove an item, all the remaining items slide over one position, into the slot that has already been inspected. That means that they get skipped.

resolution:&nbsp; -&gt; not a bug

Python tracker <;
<" rel="noopener" target="_blank">;;
Date User Action Args
2021-08-19 04:57:47py_oksetrecipients: + py_ok, steven.daprano
2021-08-19 04:57:47py_oklinkissue44952 messages
2021-08-19 04:57:47py_okcreate