所以我的字典看起来像这样:
{'wandered':[YearCount(year = 2005,count = 83769),YearCount(year = 2006,count = 87688),YearCount(year = 2007,count = 108634),YearCount(year = 2008,count = 171015)],'request':[YearCount(year = 2005,count = 646179),YearCount(year = 2006,count = 677820),YearCount(year = 2007,count = 697645),YearCount(year = 2008,count = 795265)],'机场':[YearCount(年= 2007,计数= 175702),YearCount(年= 2008,计数= 173294)]}
值保存在包含年份和计数的YearCount对象中。
如何访问每个密钥中的每个字母,例如“徘徊”,?我正在尝试创建一个列表,其中包含按总计缩放的字母的相对频率 字母按字母顺序排列。
实施例。
[0.03104758705050717, 0.0, 0.0, 0.03500991824543893, 0.2536276129665047, 0.0, 0.
0, 0.0, 0.013542627927787708, 0.0, 0.0, 0.0, 0.0, 0.017504959122719464, 0.013542
627927787708, 0.013542627927787708, 0.10930884736053291, 0.15389906233882777, 0.
10930884736053291, 0.12285147528832062, 0.10930884736053291, 0.0, 0.017504959122
719464, 0.0, 0.0, 0.0]
答案 0 :(得分:0)
你可以这样做:
for key in d:
for letter in key:
print(key, letter)