a = [1, 2, 3]
b = [4, 5, 6]
print(a+b)
It make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Basically it is used for treating consecutive sequences as a single sequence.
import itertools
a = [1, 2, 3]
b = [4, 5, 6]
c = itertools.chain(a, b)
for i in c:
print i
This method creates a generator for the items in the combined list, which has the advantage that no new list needs to be created.
This method becomes very handy if your lists are large and efficiency is a concern.
To know more about this you can have a look at the following video tutorial:-
If you are looking for upskilling yourself in python you can join our Python Certification and learn from an industry expert.