python中变量即是字典的形式维护的:


局部变量:

>>> locals().update({'a':1,'b':2}) 
>>> b
2



全局变量:

>>>globals().update({'a':1})
>>> a
1