python - Finding the index of an item in a list - Stack Overflow

PHOTO EMBED

Fri Dec 24 2021 03:31:28 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user]

>>> ["foo", "bar", "baz"].index("bar")
1
content_copyCOPY

https://stackoverflow.com/questions/176918/finding-the-index-of-an-item-in-a-list