我试着按我创建字典的顺序迭代字典,例如,我希望它按这个顺序打印名字。现在它以随机顺序打印。在
我要的菜:ExtraClick,AutoClick,PackCookies,BakeStand,GirlScouts
代码:
self.how_many_buildings = {'ExtraClick': 0,
'AutoClick': 0,
'PackCookies': 0,
'BakeStand': 0,
'GirlScouts': 0}
for name in self.how_many_buildings:
print(name)
Tags:
{a1}维护字典顺序
Dictionaries
没有顺序,因此您需要可以处理顺序的外部类。在^{dict
类上形成了一个包装类,提供了额外的功能以及{示例:
相关问题 更多 >
编程相关推荐