flatten a level one list

Paul Rubin http
Wed Jan 11 21:21:41 EST 2006


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> >>> import operator
> >>> a=[(1,2),(3,4),(5,6)]
> >>> reduce(operator.add,a)
> (1, 2, 3, 4, 5, 6)

(Note that the above is probably terrible if the lists are large and
you're after speed.)



More information about the Python-list mailing list