global 的作用

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

 

posted @ 2021-04-27 14:18  测试艺术家  阅读(115)  评论(0编辑  收藏  举报