Finding the index of an item given a list containing it in Python -
for list ["foo", "bar", "baz"]
, item in list "bar"
, what's cleanest way index (1) in python?
>>> ["foo", "bar", "baz"].index("bar") 1
reference: data structures > more on lists
Comments
Post a Comment