if you want to simply access a global variable you just use its name. However to change its value you need to use the global keyword.
change value:
x = somevalue
def func_A ():
global x
# Do things to x
return x
#just access x
def func_B ():
print(x)
网友评论