Geo*_*ows 1 python input delay
我正在阅读一个关于定义函数的教程,其中有一个关于创建新行的示例,您必须编写的代码是:
def new_line():
print
def three_lines():
new_line()
new_line()
new_line()
def nine_lines():
three_lines()
three_lines()
three_lines()
print "hello world"
print nine_lines()
print "goodbye"
Run Code Online (Sandbox Code Playgroud)
任何人都能解释为什么它在'再见'之前包含'无'?
print nine_lines()
Run Code Online (Sandbox Code Playgroud)
您正在打印调用该函数的结果nine_lines().由于该函数没有显式返回一个值(使用该return语句,如果你还没有看到,那么很快就会发现),Python返回特殊值None.
要解决此问题,请将该行更改为简单
nine_lines()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
98 次 |
| 最近记录: |