getting an item's list index

Gerhard Häring gh at ghaering.de
Sat Apr 19 09:02:04 EDT 2003


Michael Anckaert wrote:
> Hello all,
> 
> I have a list called contents. If one of the elements has the value
> "item1" for example, how can I get that elements index? [...]

contents.index("item1")

:-)

-- Gerhard





More information about the Python-list mailing list