python for循环后最后一次保存的变量


def plot_from_dic(dic,in_label):
value_list = []
if in_label != 'all':
for pic in dic[in_label]:
value_list.append(dic[in_label][pic])
else:
for label in dic:
for pic in dic[label]:
value_list.append(dic[label][pic])
if in_label == 'MODEL2':
print(len(value_list))
plot_hist(value_list,in_label+'.jpg')

in_label和label要保持不同的名字,因为for循环最后label变量会变为最后一次循环中的label


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM