【发布时间】:2020-05-31 16:52:59
【问题描述】:
我的代码正在生成一个无法解压不可迭代整数对象的 TypeError
BMI = {
15: 'underweight',
23: 'normal weight',
24: 'normal weight'
}
with open('output.txt', 'w') as out:
for k,v in BMI:
out.write('%s : %s \n' %(k, v))
我想要的文本文件输出如下所示:
15: underweight
23: normal weight
24: normal weight
【问题讨论】: