Python中如何将String类型转换为变量

时间:2021-08-04 09:00:32

Python中如何将String类型转换为变量

解决方案:

x='abc'+'123'
exec("%s = %d" % (x,2))
print(abc123)
#输出2