小编And*_*dyC的帖子

python:将变量值插入变量名称

我想将变量的值插入python中另一个变量的名称.在shell脚本中,这将是这样的:

for n in `more list`  
do  
var_$n = some_calculation  
done
Run Code Online (Sandbox Code Playgroud)

但我看不出如何在python中做类似的事情.有没有办法或者我应该使用替代方法?
谢谢,
安迪

python variables

5
推荐指数
3
解决办法
2万
查看次数

标签 统计

python ×1

variables ×1