newbie: find position of item in a list

Padraig Brady Padraig at Linux.ie
Wed Oct 2 10:36:45 EDT 2002


Alexander Eisenhuth wrote:
> Hallo Again,
> 
> i wonder weather there is no expression of finding the position of a 
> element is a list like:
> 
> l = ['a', 'b', 'c', 'd', 'e']
> 
> l.find('b')
>  >> 1
> 
> Have I overseen something in the documentation to python ?

dir(l) will tell you all the methods available for the list.
l.index('b') is what you want

Pádraig




More information about the Python-list mailing list