'''闭包:闭包:1.闭 :内部的函数 2.包 :包含了对外部函数作用域中变量的引用 '''def func(): name = 'li' def inner(): return name print(inner.__closure__) return innerprint(func()())from urllib.request import urlopendef index(url): def inner(): return urlopen(url).read() return inneru='http://www.cnblogs.com/Eva-J/articles/7156261.html#_label1'get = index(u)print(get())
来源:https://www.cnblogs.com/a19960101/p/11856701.html