Influence value of Python function
Environment: Python 2.7
Solve the problem that the function does not affect the value of the variable.
#-*-coding: utf-8-*-a = 0def b (): global an a = 1 a=a+1 print a return adef c (): global an a=a+1 print a return adef d (): print aif _ _ name__ = ='_ main__': b () c () d () c ()
Running result:
2334