python - How to get the order of an item in a list? -
python - How to get the order of an item in a list? -
i'm new python... i'm sorry if question sounds amateurish.
my_list = [1, 2, 3, 4]
i need function gives me position (or index when give item)
for example, index of 4 3..
http://www.tutorialspoint.com/python/list_index.htm
>>> my_list = [1, 2, 3, 4] >>> my_list.index(4) 3
the built-in list method index homecoming index position of first value located specified in index method's argument.
python list python-3.x
Comments
Post a Comment