15 lines
481 B
Python
15 lines
481 B
Python
import json
|
|
|
|
with open('peiwenyunfu.json', 'r', encoding='utf-8') as f:
|
|
data = json.load(f)
|
|
|
|
for rhyme, r_data in data.items():
|
|
if rhyme in ["metadata", "preface"]: continue
|
|
if "词条" in r_data:
|
|
for word, content in r_data["词条"].items():
|
|
if "丨" in content:
|
|
r_data["词条"][word] = content.replace("丨", rhyme)
|
|
|
|
with open('peiwenyunfu.json', 'w', encoding='utf-8') as f:
|
|
json.dump(data, f, ensure_ascii=False, indent=4)
|