How do I execute a string containing Python code in Python?
I tried quite a few things, but the only thing that work was the following:
temp_dict = {} exec("temp_dict['val'] = 10") print(temp_dict['val'])
output:
10