newbie: find position of item in a list

Kerim Borchaev warkid at storm.ru
Wed Oct 2 16:51:23 CEST 2002


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