The statement that you have lists of lists:
for L in list_of_lists: print " ".join(L)
The str.join(iterable) function combines the components of iteration over a given string.
Therefore, " ".join([1, 2, 3]) becomes "1 2 3".
In case I might have misunderstood the question and each list should be a column:
for T in zip(list1, list2, list3, list4, list5): print " ".join(T)
zip() combines the specified lists into a single list of tuples:
>>> zip([1,2,3], [4,5,6], [7,8,9]) [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
Hooray!
source share