with open(jsonPath,'r',encoding = 'utf-8') as load_f: load_dict = json.load(load_f) #將獲取到的appToken覆蓋到data_config下datajson.json文件對應的操做中,不是登錄 load_dict[jsonkey]['appToken'] = res['data']['appToken'] with open(jsonPath,'w',encoding = 'utf-8') as dump_f: json.dump(load_dict,dump_f,indent = 3,sort_keys = True)
#執行接口時,從datajson.json的相應操做中,獲取到最新的appTokenjson