Get position in list

Solved
erickvand -  
 hugo -
Hello,

I would like to know how to get the position of an element in a list with Python?

For example, if I have a list ['lundi', 'mardi', 'mercredi'], I would like to ask it: give me the position of mardi in the list (and logically, it should return 1).
How can I code this?

Thank you in advance.
Configuration: Windows XP Internet Explorer 6.0

5 answers

  1. Thorolf Posted messages 3 Status Member 89
     
    liste = ['Monday','Tuesday','Wednesday']

    liste.index('Tuesday')
    >>> 1

    attention => causes an error if the element is not present in the list
    107
    1. m
       
      You're a handsome guy, brother.
      10
    2. oumaima
       
      thank you
      3