使用Python的print打印值报错:
>>> print "Hello world!"
File "<stdin>", line 1
print "Hello world!"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Hello world!")
查了下资料,这是Python 2的print语法。
Python 3的语法,如提示需要加上括号:
>>> print("Hello world")
Hello world
Python 3.6.3提示:
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("xxx")
Python 3.4.2提示:
SyntaxError: Missing parentheses in call to 'print'.
Python 3.4.2之前的Python 3版本提示:
SyntaxError: invalid syntax