Fangwen Lu wrote: > Dear all- > > I want to do some loops. Each loop will generate a tuple. Eventually I > want to put tuples together in a higher level of tuple. Do you know how > to do this? > > Say a=(1,2,3), b=(4,3,2),c=(9,5,6). I want to get a tuple as ((1,2,3), > (4,3,2),(9,5,6)). > > If there are just 2 tuples, I can write x=a and then x=(x,b). But for 3 > tuples or more, I will get something like (((1,2,3), (4,3,2)),(9,5,6)). >
Are you sure you need tuples? Wouldn't lists be better, you can append generated elements to the list and finally (if you want) convert it into a tuple. -- ~noufal _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
