python can declare global variable in local scope?
It works:
def main():
# do some... for files varible
for file in files:
result = func(file)
print result
I can’t understand.
Somebody tell me why result can be seen outside the for loop.
Thanks you.
forstatements do not start a new scope. Only modules, class declarations, and function definitions start a new scope.