Can we access inner function outside its scope of outer function in python using outer function?
问题 Just for the sake of curiosity I wanna know this.. I know scope of inner function is limited to outer function body only, but still is there any way so that we can access the inner function variable outside its scope or call the inner function outside its scope ? In [7]: def main(): ...: def sub(): ...: a=5 ...: print a ...: In [8]: main() In [9]: main.sub() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home