0

When I run:

from prettytable import PrettyTable as PTable

accounts = {
    'user1': 'pass1',
    'user2': 'pass2'
}

table = PTable(['Day', [*accounts.keys()]])  #  creates empty table with headings
print(table)

My table looks like this:

+-----+--------------------+
| Day | ['user1', 'user2'] |
+-----+--------------------+
+-----+--------------------+

You can see that 'user1' and 'user2' are in the same column. How can I make it so that they are in separate columns?

Thank you.

user2357112
  • 260,549
  • 28
  • 431
  • 505
Redjman
  • 11
  • 2

1 Answers1

2

You did unpack them as separate items... of the wrong list. If you wanted to unpack them into the same list as 'Day', don't write a nested list:

['Day', *accounts.keys()]
user2357112
  • 260,549
  • 28
  • 431
  • 505