Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #assign #exec #function #variable #python
ADD COMMENT
Topic
Name
8+1 =