Using tabulate, how to print a list as a single row instead of a single column?

2k views Asked by At

With this code:

from tabulate import tabulate
print(tabulate(["0", "1", "2"]))

I get:

-
0
1
2
-

I would like to get:

-  -  -
0  1  2
-  -  -

Any ideas?

1

There are 1 answers

0
LoneCodeRanger On BEST ANSWER

Got it! This works:

print(tabulate([["0", "1", "2"]]))   # (Put the original list inside a list.)