I have tried at learnpython.org to create a variable dynamically it can be create as below :
food = \'bread\' vars()[food] = \'asdasd\' print (bread)
In python we tend to avoid this kind of dynamic variables, but anyway your answer is:
a = 'test' globals()[a] = 123 print(test)
Better approach is by using a dictionnary.
a = 'test' myVar = {} myVar[a] = 123 print(myVar['test'])