SyntaxError: name 'x' is parameter and global
原因是:变量不能同时作为global变量和函数之间传递的变量
https://blog.csdn.net/aiyoufyc001/article/details/117357800
def func():
global x
print ('x is', x)
x = 2
print ('Changed local x to', x)
x = 50
func()
print ('x is still', x )
这样就好了。