How do I execute a string containing Python code in Python?
Check out eval:
x = 1 print eval('x+1') ->2