Locals={'e': 111, 'd': 200, 'c': 100}
Globals={'__name__': '__main__', '__doc__': 'Automatically created module for IPython interactive environment', '__package__': None, '__loader__': None, '__spec__': None, '__builtin__': , '__builtins__': , '_ih': ['', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\nprint(a2)', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\n#print(a2)', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\nprint(a2)', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1) #全局变量a1\nfun()\nprint(a2) #局部变量a2', '\ndef fun():\n global b1\n b1 = 100\n print(b1)\n print("I am in fun")\n # a2的作用范围是fun\n b2 = 99\n print(b2)\n \n \n\n#print(b2)\nfun()\n# print(b1)如果在函数调用上面,则不好使,报错,为什么???\nprint(b1)', 'def fun():\n global b1\n b1 = 100\n print(b1)\n print("I am in fun")\n # a2的作用范围是fun\n b2 = 99\n print(b2)\n \n \n\n#print(b2)\nfun()\n# print(b1)如果在函数调用上面,则不好使,报错,为什么???\nprint(b1)', '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', 'a = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)'], '_oh': {}, '_dh': ['C:\\Users\\Administrator\\Python练习\\基础语法练习'], 'In': ['', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\nprint(a2)', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\n#print(a2)', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\nprint(a2)', '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1) #全局变量a1\nfun()\nprint(a2) #局部变量a2', '\ndef fun():\n global b1\n b1 = 100\n print(b1)\n print("I am in fun")\n # a2的作用范围是fun\n b2 = 99\n print(b2)\n \n \n\n#print(b2)\nfun()\n# print(b1)如果在函数调用上面,则不好使,报错,为什么???\nprint(b1)', 'def fun():\n global b1\n b1 = 100\n print(b1)\n print("I am in fun")\n # a2的作用范围是fun\n b2 = 99\n print(b2)\n \n \n\n#print(b2)\nfun()\n# print(b1)如果在函数调用上面,则不好使,报错,为什么???\nprint(b1)', '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', 'a = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)'], 'Out': {}, 'get_ipython': >, 'exit': , 'quit': , '_': '', '__': '', '___': '', '_i': 'a = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '_ii': '\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '_iii': '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '_i1': '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\nprint(a2)', 'a1': 100, 'fun': , '_i2': '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\n#print(a2)', '_i3': '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1)\nfun()\nprint(a2)', '_i4': '# 认为a1是全局的\na1 = 100\n\ndef fun():\n print(a1)\n print("I am in fun")\n # a2的作用范围是fun\n a2 = 99\n print(a2)\n \n \nprint(a1) #全局变量a1\nfun()\nprint(a2) #局部变量a2', '_i5': '\ndef fun():\n global b1\n b1 = 100\n print(b1)\n print("I am in fun")\n # a2的作用范围是fun\n b2 = 99\n print(b2)\n \n \n\n#print(b2)\nfun()\n# print(b1)如果在函数调用上面,则不好使,报错,为什么???\nprint(b1)', 'b1': 100, '_i6': 'def fun():\n global b1\n b1 = 100\n print(b1)\n print("I am in fun")\n # a2的作用范围是fun\n b2 = 99\n print(b2)\n \n \n\n#print(b2)\nfun()\n# print(b1)如果在函数调用上面,则不好使,报错,为什么???\nprint(b1)', '_i7': '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', 'a': 1, 'b': 2, '_i8': '\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '_i9': 'a = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)', '_i10': '# globals 和 locals\n# globals 和 locals 叫做内建函数\na = 1\nb = 2\n\ndef fun(c,d):\n e = 111\n print("Locals={0}".format(locals()))\n print("Globals={0}".format(globals()))\n \nfun(100, 200)'}