为什么这返回 None ? [英] Why does this return None?
本文介绍了为什么这返回 None ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在测试 repl.it(运行 Python 3.5.1),然后我注意到控制台的每一行输入,控制台都会回复 None
.我没有使用任何带有忘记返回值的花哨定义,即使在赋值语句之后也会发生这种情况.这里发生了什么?
I'm testing out repl.it (running Python 3.5.1) and I noticed that after every line of input into the console, the console replies with None
. I'm not using any fancy definitions with forgotten return values, this happens even after assignment statements. What is going on here?
示例:
x,y,z=1,2,3
=> None
print(x+y+z)
6
=> None
推荐答案
None 是没有返回值的语句的默认返回值.一些解释器外壳显示它,有些不显示.
None is the default return value of statements that do not have a return value. Some interpreter shells display it, some don't.
这很正常,不用担心.
这篇关于为什么这返回 None ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文