How to extend/concatenate two iterators in Python [duplicate]
Use itertools.chain: from itertools import chain y_iter = chain(l1, l2) It yields all the items from l1 and then all the items from l2. Effectively concatenating the sequence of yielded items. In the process it consumes both.