Answers for "assign exec function to variable python"

0

assign exec function to variable python

old_string = "didn't work"
new_string = "worked"

def function():
    exec("global old_string; old_string = new_string")
    print(old_string)

function()
Posted by: Guest on September-09-2020

Code answers related to "assign exec function to variable python"

Python Answers by Framework

Browse Popular Code Answers by Language