Re: Accessing items in nested tuples

2009-04-22 Thread Rhodri James
On Tue, 21 Apr 2009 21:45:21 +0100, alex wrote: Tim and Mensanator Thank you very much, this will get me further. I can not recall having seen this in my books... I am still getting my grips with Python and OOP. Think of it this way, Alex: data[0] gave you back the tuple ('aa', ('bb', 'cc',

Re: Accessing items in nested tuples

2009-04-21 Thread alex
Tim and Mensanator Thank you very much, this will get me further. I can not recall having seen this in my books... I am still getting my grips with Python and OOP. Regards Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing items in nested tuples

2009-04-21 Thread Mensanator
On Apr 21, 3:03 pm, alex wrote: > Hello everybody > I am able to access the data in a tuple via a for loop (see example > below). > > #!/usr/bin/env python > > class Test(): >     def Data(self): >         return ("aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh") > #        return (("aa", ("bb", "cc

Re: Accessing items in nested tuples

2009-04-21 Thread Tim Chase
IDLE 1.2.1 data=(("aa", ("bb", "cc", "dd")), ("ee", ("ff", "gg", "hh")), ("ii", ("jj", "kk", "ll"))) print data[0] ('aa', ('bb', 'cc', 'dd')) print data[1] ('ee', ('ff', 'gg', 'hh')) etc... I would like to be able to access the dataitem "aa" or "bb", "cc", "dd" individualy. You're s