This is the behaviour I'm looking for...
"a = 2" # execute this line
print a
> 2
I know about the exec statement but I need it to work in python 2 and 3 and python 3 does not allow exec to create local variables. Is there another way around this?
EDIT: Like I said - I know that I can't use exec, the accepted answer of the supposed duplicate is saying to use exec.