python - 这到底有什么问题?

标签 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"

谁能解释为什么它在“再见”之前包含“无”?

最佳答案

print nine_lines()

您正在打印调用 nine_lines() 函数的结果。由于该函数不会显式返回值(使用return 语句,如果您还没有看到它,那么您很快就会看到),Python 返回特殊值

要解决这个问题,只需将该行更改为

nine_lines()

关于python - 这到底有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7934181/

相关文章:

html - 组件交互@Input

paypal - 将初始付款延迟到 Paypal 订阅按钮上的特定日期

python - 如何在Python中将时间戳转换为字符串

python - Azure 服务总线队列发送和接收消息的测试

python - 实现双向 A* 最短路径算法

HTML 5 区别输入 ID 和输入名称?

python - 在列表推导式中将 groupby() 与过滤器一起使用

java - 需要扫描仪输入阵列

css - OnLoad 和调整大小 css 中断

ios - 如何编程延迟?