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 same time ?
What’s the pythonic way to do something like that ?
for f in l1,l2 and l3:
print f
This only seems to be taking 2 lists into account.
Desired output: for each element in all the lists, I’m printing them out using a different function
def print_row(filename, status, Binary_Type):
print " %-45s %-15s %25s " % (filename, status, Binary_Type)
and I Call the above function inside the for loop.
I think you might want
zip:What you’re doing:
is a little strange. It is basically equivalent to
for f in (l1,l3):sincel2 and l3returnsl3(assuming thatl2andl3are both non-empty — Otherwise, it will return the empty one.)If you just want to print each list consecutively, you can do: