Message399886
To understand why your code doesn't work, run this:
items = ['a', '', 'b', '', 'c', '', 'd', '', 'e', '']
print(len(items))
for index, item in enumerate(items):
print(index, repr(item), items)
if item == '':
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. |
|
Date |
User |
Action |
Args |
2021-08-19 04:53:29 | steven.daprano | set | recipients:
+ steven.daprano, py_ok |
2021-08-19 04:53:29 | steven.daprano | set | messageid: <1629348809.81.0.600587264024.issue44952@roundup.psfhosted.org> |
2021-08-19 04:53:29 | steven.daprano | link | issue44952 messages |
2021-08-19 04:53:29 | steven.daprano | create | |
|