如何在一个函数内部修改全局变量

#coding=utf-8
a=5
def test():
    global a
    print(a)
test()

输出

 5

例子

#coding=utf-8
a=5
def test():
    global a
    a=10
test()
print(a)

输出

10
原文地址:https://www.cnblogs.com/sea-stream/p/10765853.html