This commit is contained in:
2025-09-10 13:26:53 +08:00
parent 20e3a294ea
commit a19db36b7d
14 changed files with 2 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
# 读取 Dict 目录下 ChinaCitys2025.json # 读取 Dict 目录下 ChinaCitys2025.json
import json import json
with open(r'D:\dsWork\YunNanProject\Dict\ChinaCitys2025.json', 'r', encoding='utf-8') as f: with open(r'/Dict/ChinaCitys2025.json', 'r', encoding='utf-8') as f:
data = json.load(f) data = json.load(f)
# 筛选云南省数据并格式化输出 # 筛选云南省数据并格式化输出
try: try:
@@ -16,7 +16,7 @@ with open(r'D:\dsWork\YunNanProject\Dict\ChinaCitys2025.json', 'r', encoding='ut
# 格式化输出 # 格式化输出
print(json.dumps(yunnan_data, ensure_ascii=False, indent=4)) print(json.dumps(yunnan_data, ensure_ascii=False, indent=4))
with open('../Dict/云南省行政区划数据.json', 'w', encoding='utf-8') as outfile: with open('../../Dict/云南省行政区划数据.json', 'w', encoding='utf-8') as outfile:
json.dump(yunnan_data, outfile, ensure_ascii=False, indent=4) json.dump(yunnan_data, outfile, ensure_ascii=False, indent=4)
print("\n数据已保存至:云南省行政区划数据.json") print("\n数据已保存至:云南省行政区划数据.json")

0
Tools/Check/__init__.py Normal file
View File