provided that I have two lists in same length, list_a, list_b.
I can print they items in a single for loop as follows:
for i in range(0, len(list_a)):
print "%s %s" % (list_a[i], list_b[i])
is there any alternative and elegant way to do above mentioned task ?
I have tried
for a, b in list_a, list_b:
print ""
You need
zip():When the lists are long and you are using Python 2.x, you might prefer
itertools.izip()to save some memory.