Python print in terminal returns "invalid syntax"

I am using terminal on my mac to run some python, and when I try to print a line, I get an invalid syntax error.

Michaels-MBP:~ mike$ python
File "", line 2
SyntaxError: invalid syntax


I tried it with single quotes and with and without parentheses, but I keep getting this error which is not the case.


source to share

1 answer

Should be:



You have the correct British quotes ‘foo’

. These are the correct characters to use when writing human-readable text, but Python wants single quotes '


Your editor may have some kind of smart quotes feature, it is advisable to disable this when writing code (for example, configure the editor to detect extensions such as .py




All Articles