import json, os, collections d = json.load(open('docs_cmp_result2.json', encoding='utf-8')) C = d['truly_missing'] # [path, mtime, size] print("C类总数:", len(C)) grp = collections.defaultdict(list) for p, mt, sz in C: top = p.split('\\')[0] grp[top].append((p, sz)) for top in sorted(grp, key=lambda k: -len(grp[k])): items = grp[top] print("\n### %s (%d 个)" % (top, len(items))) for p, sz in items[:8]: print(" %s (%dKB)" % (os.path.basename(p), sz // 1024)) if len(items) > 8: print(" ... 其余 %d 个" % (len(items) - 8))