Answers for "how to add variable in a string in python"

2

how to give a string value variable in python

foo = "bar"
exec(foo + " = 'something else'")
print bar
something else
Posted by: Guest on April-04-2021

Code answers related to "how to add variable in a string in python"

Python Answers by Framework

Browse Popular Code Answers by Language