newbie: find position of item in a list

a.clarke11 a.clarke11 at pop.ntlworld.com
Thu Oct 3 00:56:43 CEST 2002


Hi
So what's wrong  with l.find('b')? Or, what's the gain in using index()?
Tia
Tony

Kerim Borchaev wrote:

> Hello Alexander,
>
> Wednesday, October 2, 2002, 6:24:52 PM, you wrote:
>
> AE> Hallo Again,
>
> AE> i wonder weather there is no expression of finding the position of a element is a list like:
>
> AE> l = ['a', 'b', 'c', 'd', 'e']
>
> AE> l.find('b')
> AE>   >> 1
>
> AE> Have I overseen something in the documentation to python ?
>
> yes:
>
> >>> l = ['a', 'b', 'c', 'd', 'e']
> >>> l.index('d')
> 3
>
> Best regards,
>  Kerim                            mailto:warkid at storm.ru
>
> AE> Tanks a lot
> AE> Alexander




More information about the Python-list mailing list