使用 Python 3 打印时出现语法错误 [英] Syntax error on print with Python 3
本文介绍了使用 Python 3 打印时出现语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么在 Python 3 中打印字符串时会收到语法错误?
<预><代码>>>>打印你好世界"文件<stdin>",第 1 行打印你好世界"^语法错误:无效语法 解决方案
在 Python 3 中,print
变成了一个函数.这意味着您现在需要像下面提到的那样包含括号:
print("Hello World")
Why do I receive a syntax error when printing a string in Python 3?
>>> print "hello World"
File "<stdin>", line 1
print "hello World"
^
SyntaxError: invalid syntax
解决方案
In Python 3, print
became a function. This means that you need to include parenthesis now like mentioned below:
print("Hello World")
这篇关于使用 Python 3 打印时出现语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文