Okay. So my question is simple: How can I assign the value of a variable using eval in Python? I tried eval(\'x = 1\') but that won\'t work. It returns a Syntax
eval(\'x = 1\')
You can actually put exec() command inside eval()
exec()
eval()
So your statement would look like eval("exec('x = 1')")
eval("exec('x = 1')")
p.s. this is dangerous