2017年9月20日

python generator(生成器)

摘要: send的用法: 输出: onetwothreefourfive 阅读全文

posted @ 2017-09-20 21:13 靖康耻 阅读(124) 评论(0) 推荐(0) 编辑

python 装饰器

摘要: 输出: start1start2code haha0.0end2end1hello__zxl 输出: 不打印日志start2(3, 4, 5, 6, 7)0.0end225 阅读全文

posted @ 2017-09-20 18:32 靖康耻 阅读(130) 评论(0) 推荐(0) 编辑

用reduce实现阶乘计算

摘要: 输出: 120 阅读全文

posted @ 2017-09-20 17:46 靖康耻 阅读(483) 评论(0) 推荐(0) 编辑

python实现裴波那契数列

摘要: 用生成器实现如下: 阅读全文

posted @ 2017-09-20 17:15 靖康耻 阅读(1026) 评论(0) 推荐(0) 编辑

python新增nonlocal关键字

摘要: def fa(a): b = 2 def fb(): nonlocal b print(b) return fbc = 2fa(22)()# python作用域:LEGB 阅读全文

posted @ 2017-09-20 16:16 靖康耻 阅读(171) 评论(0) 推荐(0) 编辑

python 作用域(LEGB)

摘要: 输出: 55510088810000 阅读全文

posted @ 2017-09-20 13:55 靖康耻 阅读(105) 评论(0) 推荐(0) 编辑

导航