O
omission9
Suppose I have a lists of tuples
A_LIST=[(1,6,7),(7,4,2),(7,9,2),(1,5,5),(1,1,1)]
and an int
i=1
What is the fastest way in python to get out all the tuples from the
list whose first element is equal to i?
A have a very large list and a simple
for a in A_LIST:
if a[0]==i:
#We have a match!!
Seems to be very slow and there must be some super quick pythonic way to
do this maybe?
Any avice would be much appreciated!!
A_LIST=[(1,6,7),(7,4,2),(7,9,2),(1,5,5),(1,1,1)]
and an int
i=1
What is the fastest way in python to get out all the tuples from the
list whose first element is equal to i?
A have a very large list and a simple
for a in A_LIST:
if a[0]==i:
#We have a match!!
Seems to be very slow and there must be some super quick pythonic way to
do this maybe?
Any avice would be much appreciated!!