getting an item's list index

Michael Anckaert xantor at linux.be
Sat Apr 19 14:57:45 CEST 2003


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?


for item in contents:
	# here I need to get that items index

-- 
Greetings,
Michael Anckaert, aka The XanTor
OpenPGP key: F7A6C3AB
Fingerprint: A329 43FC 3953 A944 5DDC  2E05 8E5D AD60 F7A6 C3AB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20030419/00be999c/attachment.pgp>


More information about the Python-list mailing list