I want do define a Python function with exec
like this:
exec """def my_func(alpha = 'a'):
return alpha"""
It works. However, for a specific reason I want to to define the alpha = 'a'
in a separate string:
s = "alpha = 'a'"
exec """def my_func(s):
return alpha"""
but this one doesn't work. Is there a way to insert a string variable content into multiline comment string this way?