Re: [Tutor] search a tuple of tuples

2007-01-21 Thread johnf
On Sunday 21 January 2007 10:30, you wrote: > johnf wrote: > > 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 my

Re: [Tutor] search a tuple of tuples

2007-01-21 Thread Kent Johnson
johnf wrote: > 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]: This is better written as iteration over mytuple

[Tutor] search a tuple of tuples

2007-01-21 Thread johnf
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 us