当前位置:首页 > 云计算 > 正文内容

python 3.3使用print输出保语法错误是什么原因?

2022-05-04 03:27:36云计算3

在python3.3使用下面的print语句打印时会报错:

print"helloWorld"

报错如下:

File "<ipython-input-3-c3365d283592>", line 1

print "hello World"

^

SyntaxError: Missing parentheses in call to 'print'. Did you mean print("hello World")?

原因:

在Python 3中print已变成可调用函数而不是语句。所以在我们使用print打印时需要将打印内容使用()包含。

如下:

print("helloWorld")

输出结果:

hello World

更多Python知识请关注Python自学网

本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.

本文链接:https://www.xibujisuan.cn/16956.html

标签: Python