Newbie needs help

pip install tabulate
from tabulate import tabulate

table = [[‘class’ , ‘var’ , ‘1’],
[‘cat’ , ‘dog’ , ‘2’],
[‘aa’ , ‘bb’ , ‘3’]]


When I run it I get:

C:\Users\Han\anaconda3\python.exe C:\Users\Han\PycharmProjects\pythonProject\
File “C:\Users\Han\PycharmProjects\pythonProject\”, line 1
pip install tabulate
SyntaxError: invalid syntax

Process finished with exit code 1

What did I do wrong? Trying to make columns out of lists.

The line that says:

pip install tabulate

does not go in your program. That’s a command that you run separately, before you run your program, which will download and install the tabulate package on your computer. This is where the module that you import in this line:

from tabulate import tabulate

at the beginning of your program, comes from.


Oh, I get it. I had to choose one or the other, not both. Now it works. Thanks :slight_smile:

Thanks. I had to choose one or the other, i get it. Now it works :slight_smile: