global 的作用

a = 10
def test():
    global a
    a = 5
    print(a)
test()
print(a)

 

posted @ 2021-04-27 14:18  自然观察家  阅读(128)  评论(0)    收藏  举报