Answers for "python find item in a list"

50

python find item in list

>>> ["foo", "bar", "baz"].index("bar")
1
Posted by: Guest on November-19-2019
0

how to search for an item in a list in python

l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
index_of_4 = l.index(4)
print(index_of_4)
##output:
## 3
Posted by: Guest on June-30-2021

Code answers related to "python find item in a list"

Python Answers by Framework

Browse Popular Code Answers by Language