def info():
url = "http://ct.91link.com:6084/ysk/mz/project/detail.do"
data = {"projectId": "4769015018864xxx",
"extMerch": "8168000000152453xxx"
}
headers = {'Content-Type': 'application/json '}
# requests.get()
res = requests.post(url=url, data=json.dumps(data), headers=headers)
print("test",res.text)
'''
list列表去其中一个值,用list[0]
dic字典取其中一个值,用字典值中一个key名dict['name']
'''
print("json", res.json()['code'])#test {"code":"200","msg":"成功","result":"111"}
j=json.loads(res.text)
print("json",j['code'])
# key_list=list(rj[0])
#print("key_list", key_list[0])
if j['code']=='200' :#res.text=='200':
print("msg:成功了")
else:
print("msg:失败了")
info()
list列表取其中一个值,用list[0] ,dic字典取其中一个值,用字典值中一个key名dict[‘name‘]
最新推荐文章于 2024-06-19 11:20:50 发布