I am trying to use a Python list comprehension to get the Variable Name SW1 to equal the string "sw1" but I keep getting an error saying sw1 not defined
VarList = ["SW1"]
VarListEnd = ["sw1"]
list3 = [exec("%s="%x + "%s"%y) for x in VarList for y in VarListEnd]
list3
How do I amend the exec statement because that is where I think the error is? Really appreciate your help. Thanks in advance.