[Tutor] questions about tuples

Fangwen Lu lufangwen at gmail.com
Wed Sep 26 19:07:50 CEST 2007


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)).

Thanks.

Fangwen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070926/877357e9/attachment.htm 


More information about the Tutor mailing list