input_python = {
'n_layer':n_layer,
'L':L,
'Emm':Emm,
'mu':mu,
'h':h,
'P':P,
'Q':Q,
'a':a,
'p':[p],
'q':[q],
'xx_':xx_,
'yy_':yy_,
'n_d':n_d,
'upper_h':upper_h,
'n_i':n_i,
'n_series':n_series,
'xx':xx,
'yy':yy,
'zz':zz,
'NN':NN
}
# 将输入数据格式化写入input.json文件
with open("./input.json", 'w') as input_json:
json.dump(input_python, input_json, indent=4, ensure_ascii=False)
# 运行rust程序
r_v = os.system(main)
# 读取output.json文件中的输出结果
with open('./output.json','r',encoding='utf8')as fp:
json_data = json.load(fp)
标签:输出,python,xx,yy,json,input
From: https://www.cnblogs.com/Nazorine/p/16708843.html