python_request 使用jsonpath取值结果,进行接口关联

一、jsonpath的安装

pip   install  jsonpath  

二、使用举例

import  jsonpath


d1={"token":"hjshdsjhdsjadhsa","expire":"7200"}
print( jsonpath.jsonpath(d1,'$.token')[0])

输出的值为:

 三、与项目的结合使用

猜你喜欢

转载自www.cnblogs.com/123anqier-blog/p/13405731.html