我将avg_dict = {}
for idx, name_dict in numbers_dict.items():
num_items = name_dict['count']
dct = {}
for name, numbers in name_dict.items():
if name != 'count':
dct[name] = sum(numbers)/num_items
avg_dict[idx] = dct
print(avg_dict)
{'0': {'name1': 0.3, 'name2': 0.25}, '1': {'name1': 0.04, 'name2': 0.6799999999999999}}
放到了Mac终端上,但并没有给我以前的命令!
^C