Well, like this I guess:
Also, this I guess:
Lots of stuff here:
http://stackoverflow.com/questions/95291...-in-python
x = ['a','b','c','d','e','f'] doubles = [item for pair in zip(x,x) for item in pair] print(doubles)But do you really think that is clearer than this:
doubles = [] for item in x: doubles.extend([item]*2) print(doubles)Matter of taste I guess. Honestly not sure which I prefer.
Also, this I guess:
import itertools x = ['a','b','c','d','e','f'] doubles = list(itertools.chain(*zip(x, x))) print(doubles)Basically it is a list flattening problem.
Lots of stuff here:
http://stackoverflow.com/questions/95291...-in-python