开发者社区 问答 正文

函数调用问题

函数调用问题

展开
收起
珍宝珠 2019-11-19 16:09:39 2297 分享 版权
1 条回答
写回答
取消 提交回答
  • #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    
    def hello_world():
        print 'hello world'
    
    def three_hellos():
        for i in range(3):
            hello_world()
    if __name__ == '__main__':
        three_hellos()
    
    

    以上实例输出结果为:

    hello world
    hello world
    hello world
    
    2019-11-19 16:11:58
    赞同 展开评论
问答地址: