Raymond Hettinger <[email protected]> added the comment:
The index() method is working as expected. This isn't a bug.
The easiest way to accomplish your goal is to use enumerate() with a list
comprehension:
>>> po = [11,22,33,44,11,55,66,11,88]
>>> [i for i, value in enumerate(po) if value == 11]
[0, 4, 7]
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42026>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com