变量名动态命名和调用

for i in range(3):
exec('saved_path_{} = "7_26_DPPO_step_5_piece_6_{}"'.format(i, 15+2*i))
for i in range(3):
exec('print(saved_path_{}, end=" ")'.format(i))
原文地址:https://www.cnblogs.com/lin-kid/p/10631646.html