tuples from lists
Sean Ross
sross at connectmail.carleton.ca
Sun Mar 9 20:00:48 EST 2003
"Adonis" <adonisv at earthlink.net> wrote in message
news:hMRaa.2085$d64.419 at tornadotest1.news.pas.earthlink.net...
> "Bob Roberts" <bobnotbob at byu.edu> wrote in message
> news:c4e6b17d.0303091212.4fee8ea9 at posting.google.com...
> > I have a list of lists of lists. How can I turn that into a tuple of
> > tuples of tuples?
>
> >>> x = [[1,2,3],[4,5,6],[7,8,9]]
> >>> tuple([tuple(y) for y in x])
> ((1, 2, 3), (4, 5, 6), (7, 8, 9))
>
>
you could also use:
tuple(map(tuple, x))
More information about the Python-list
mailing list