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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -