I have this list of lists:
tableData = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]
that i have to transform into this table:
apples Alice dogs
oranges Bob cats
cherries Carol moose
banana David goose
The trick for me, is have the "lines" to be converted into columns (i.e. apples, oranges, cherries, banana under same column)
I have tried different options (A):
for row in tableData:
output = [row[0].ljust(20)]
for col in row[1:]:
output.append(col.rjust(10))
print(' '.join(output))
option (B):
method 2
for i in tableData:
print( i[0].ljust(10)+(str(i[1].ljust(15)))+(str(i[2].ljust(15)))+
(str(i[3].ljust(15))))
None seems to address the issue.
Thanks in advance for any suggestions.