刚刚安装了Python,最基本的打印出现语法错误

bcm*_*cfc 0 python

我刚刚安装了Python 3.1.3并尝试从Python Shell运行最基本的打印.下面是shell的ac/p.我已经迷路了.为什么会出现语法错误?从这里的东西判断它不应该.

Python 3.1.3 (r313:86834, Nov 27 2010, 17:20:37) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.

>>> print "test"
SyntaxError: invalid syntax
>>> print 'test'
SyntaxError: invalid syntax
>>> 
Run Code Online (Sandbox Code Playgroud)

Fal*_*rri 6

你正在使用python 3.在python 3中print是一个函数

print ("test")
Run Code Online (Sandbox Code Playgroud)

  • 老实说?我想说要学习Python 2.是的,Python 3是未来,但它还有很长的路要走,现在大多数书籍,教程和在线资源都集中在Python 2上.一旦你学会了Python 2 ,熟悉这些概念,您可以转到Python 3,熟悉语法和标准库的变化. (4认同)