Suppose I have 3 lists such as these
l1 = [1,2,3]
l2 = [4,5,6]
l3 = [7,8,9]
how do I get to print out everything from these lists at the s
It depends on what you want to achieve,
>>> #Given
>>> l1,l2,l3 = [1,2,3],[4,5,6],[7,8,9]
>>> #To print row wise
>>> import itertools
>>> for f in itertools.chain(l1,l2,l3):
print(f,end=" ")
1 2 3 4 5 6 7 8 9
>>> #To print column wise
>>> for f in itertools.izip(l1,l2,l3):
print(*f,end=" ")
1 4 7 2 5 8 3 6 9
>>>
or the following implementation which will work in Python 2.7
>>> for f in itertools.chain(*itertools.izip(l1,l2,l3)):
print f,
1 4 7 2 5 8 3 6 9
>>>