how to get the index or the element itself of an element found with "if element in list"
Posted
by fmsf
on Stack Overflow
See other posts from Stack Overflow
or by fmsf
Published on 2010-03-16T04:23:06Z
Indexed on
2010/03/16
5:06 UTC
Read the original article
Hit count: 340
Hey,
Does a direct way to do this exists?
if element in aList:
#get the element from the list
I'm thinking something like this:
aList = [ ([1,2,3],4) , ([5,6,7],8) ]
element = [5,6,7]
if element in aList
#print the 8
© Stack Overflow or respective owner