函数内部修改全局变量

var = 5
def func():
    global var
    var = 6
print(6)
原文地址:https://www.cnblogs.com/sea-stream/p/11190536.html