import json d = json.load(open('02_加工数据/参校本对照_药目核对.json', encoding='utf-8')) det = d['异文明细'] BOILER = {'治', '无毒', '有毒', '小', '微', '寒', '大寒'} substantive = {} for name, frags in det.items(): real = [] for f in frags: s, w = f['孙'], f['维基'] if s == '' and w in BOILER: continue if w == '' and s in BOILER: continue real.append(f) if real: substantive[name] = real print('实字异文条目(粗):', len(substantive), '/ 总异文', len(det)) for n in list(substantive)[:25]: line = '; '.join("孙[%s]→维[%s]" % (f['孙'], f['维基']) for f in substantive[n][:5]) print('■', n, '|', line[:140]) json.dump(substantive, open('02_加工数据/_tmp_实字异文.json', 'w', encoding='utf-8'), ensure_ascii=False, indent=1) print('已写 02_加工数据/_tmp_实字异文.json')