[Tutor] search a tuple of tuples
johnf
jfabiani at yolo.com
Sun Jan 21 17:40:53 CET 2007
Hi,
I want to find a item within a large tuple that contains tuples.
mytuple = (('name',123,'value'),('first',345,'newvalue'))
so a 'for loop' works
istrue = False
for i in range(len(mytuple)):
if 'first' in mytuple[i]:
istrue = True
break
if istrue:
print " true"
Is possible to use a generator or list comp. All I want to know is it True or
False that mytuple contains 'first'.
--
John Fabiani
More information about the Tutor
mailing list