python基础,计数器函数(闭包的使用)

def createCounter(): def counter(): return next(o) def f(): i=0 while 1: i=i+1 yield i o=f() return counter
相关文章
相关标签/搜索