Back
Let's say I have a list
["foo", "bar", "baz"]
In python, How can I get the index of the "bar" element in the list?
You can use "index"
Look at the following code:
>>> ["foo", "bar", "baz"].index("bar")
1
31k questions
32.8k answers
501 comments
693 users