Best50Update Draft
This commit is contained in:
20
MusicDB.py
Normal file
20
MusicDB.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# 感谢伟大的 Diving-Fish 让我被迫直面恐惧写这个逼玩意
|
||||
|
||||
import xml.dom.minidom as minidom
|
||||
from pathlib import Path
|
||||
import rapidjson as json
|
||||
from typing import Dict, Union
|
||||
|
||||
# 定义音乐数据库的类型注解
|
||||
MusicDBType = Dict[int, Dict[str, Union[int, str]]]
|
||||
|
||||
# 将 '__all__' 用于模块导出声明
|
||||
__all__ = ['musicDB']
|
||||
|
||||
# 读取并解析 JSON 文件
|
||||
with open('musicDB.json', 'r', encoding='utf-8') as f:
|
||||
# 使用 json.load 直接从文件对象读取 JSON 数据
|
||||
data = json.load(f)
|
||||
|
||||
# 将 JSON 数据转换为指定格式的字典
|
||||
musicDB: MusicDBType = {int(k): v for k, v in data.items()}
|
||||
Reference in New Issue
Block a user