buffer = "temp['{key_info}'] = macro_info['{key_info}'][i]"
suite_content = ''
for i in range(3, 10):
dic = dict.fromkeys(['key_info'])
dic['key_info'] = macro_info.keys()[i]
suite_content = ((buffer.format_map(dic)))
exec(suite_content)
info.append(copy.deepcopy(temp))
print(info)
将多行字符串转换为可执行代码 exec() python
最新推荐文章于 2022-09-29 14:39:06 发布