How to join list of lists into a single list in Python

Module itertools provides the functionality to join list of lists into a single list.

import itertools
print list(itertools.chain.from_iterable(listname))

Where 'listname' is the name of the outer list.

 

Leave a Reply

Your email address will not be published. Required fields are marked *