Open this example in the interactive library
Source code
from itertools import chain
print(list(chain([1, 2], [3, 4])))Sample output
[1, 2, 3, 4]

Chain multiple iterables. A self-contained example using the Python standard library.
Open this example in the interactive library
from itertools import chain
print(list(chain([1, 2], [3, 4])))[1, 2, 3, 4]