摘要: 1. 摘要 通俗的理解__name__ == '__main__':假如你叫小明.py,在朋友眼中,你是小明(__name__ == '小明');在你自己眼中,你是你自己(__name__ == '__main__')。 if __name__ == '__main__'的意思是:当.py文件被直接 阅读全文
posted @ 2020-05-20 14:32 潇潇竹林 阅读(418) 评论(0) 推荐(0)
摘要: import time def test1(): time.sleep(3) print('in the test1') def test2(): time.sleep(3) print('in the test2') test1() test2() 阅读全文
posted @ 2020-05-20 10:40 潇潇竹林 阅读(110) 评论(0) 推荐(0)
摘要: 定义:本质是函数,(装饰其他函数)就是为其他函数添加功能 原则:1,不能修改被装饰的函数的源代码。 __author__ = "zhou" def fib(max): n, a, b = 0, 0, 1 while n < max: #n<10 yield b a, b = b, a + b n = 阅读全文
posted @ 2020-01-04 11:26 潇潇竹林 阅读(96) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2020-01-03 14:13 潇潇竹林 阅读(2) 评论(0) 推荐(0)