python print"hello world"vs"hello world"

lim*_*ala 4 python

>>> print "hello world"
hello world
>>> "hello world"
'hello world'
>>> 
Run Code Online (Sandbox Code Playgroud)

有什么不同?

一个完整的菜鸟问题.

python hello world示例主要用于

print "hello world"
Run Code Online (Sandbox Code Playgroud)

我可以删除它print,只是"Hello world"用于给出python介绍吗?

mgi*_*son 10

区别在于print调用,str而REPL的默认操作(读取评估打印循环)是调用repr对象,除非它是None.

请注意,如果您没有使用交互式解释器(您不在REPL中),那么在没有版本的情况下您将看不到任何输出print.

另请注意,输出之间存在差异. repr在字符串上添加引号.