import tomllib with open("config.toml", "rb") as f: # 必须二进制模式 config = tomllib.load(f)[4](@ref)