Big Aus
Big Aus

Reputation: 59

How to print the items from 3 different list into one line

I have 3 list of equal length I need to print each of their items onto one line. And it is from an input in a while loop so I don't know how long the length is I just know they will be equal.

list1 = ["Bob","Joe","Fred"]
list2 = [56,13,16]
list3 = ["1-26-5","1-8-9","1-7-6"]
print "Bob" 56 "1-26-5"
print "Joe" 13 "1-8-9"
print "Fred" 13 "1-7-6"

Upvotes: 0

Views: 25

Answers (1)

inspectorG4dget
inspectorG4dget

Reputation: 114025

Ahh, the much hated python3 print function is so powerful

from __future__ import print_function

for z in zip(list1, list2, list3):
    print(*z, sep=' ')

Upvotes: 1

Related Questions