seasp...@gmail.com wrote: > a list like L = [[1, 2], [3, 4, 5], [6]], which has > random numbers of list, which has random numbers. > > How do I get another list m = [1, 2, 3, 4, 5, 6] in a succinct way? ( or > iterate them) I should provide my own solution, but I really can't come > out with one.
sum(L, []) list(itertools.chain.from_iterable(L)) but as a learning experience you should do this at least once with two nested for loops, then again with a single for loop and list.extend(). -- https://mail.python.org/mailman/listinfo/python-list