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