tha*_*ote 0 python scope
python可以在本地范围内声明全局变量吗?
有用:
def main(): # do some... for files varible for file in files: result = func(file) print result
我无法理解.有人告诉我为什么result可以在for循环外看到.
result
for
谢谢.
Ign*_*ams 6
for语句不会启动新范围.只有模块,类声明和函数定义才能启动新范围.
归档时间:
13 年,2 月 前
查看次数:
150 次
最近记录:
12 年,9 月 前