I'm porting some Python 2 code to Python 3
I know this code snippet is bad practice, but I am looking for a way replace the exec() calls. I basically get "None" back, as predicted by the migration documents. I tried eval() but I get syntax error messages.
What are the alternatives dynamically generating variable names?
value = "test"
for field in ['overviewSynopsis', 'callsToAction_productLevel']:
exec(field +'_value = ""')
exec(field +'_value = value')
print(exec(field + "_value"))