You can use itertools.chain.from_iterable and zip :
>>> data = [1,2,3,4] >>> tweets = ['a','b','c','d'] >>> list(chain.from_iterable(zip(data,tweets))) [1, 'a', 2, 'b', 3, 'c', 4, 'd']
Use itertools.izip for an efficient memory solution.
Ashwini chaudhary
source share