You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
322 B

from collections import *
import json
info = json.load(open('course_info.json', 'r'))
cnt = defaultdict(list)
new_cnt = defaultdict(list)
for k, v in info.items():
new_cnt[v['type']].append((k,v['rate'],v['status'])) # 课程类型作为键课程id作为值
print(new_cnt)
for k,v in new_cnt.items():
print(k,v)