tuples from lists

Andrew Koenig ark at research.att.com
Sun Mar 9 15:38:20 EST 2003


Bob> I have a list of lists of lists.  How can I turn that into a tuple of
Bob> tuples of tuples?

        def alltuples(x):
            if isinstance(x, list):
                x = tuple(map(alltuples, x))
            return x




More information about the Python-list mailing list