调用
def run_get(url):
res = requests.get(url).json()
return res
def q_list(res):
q = jsonpath.jsonpath(res,'$.debugInfo[*].Info[*].q')
for i in range(len(q)):
q_list = []
ql = q[i].split('OR')
qla = ql[-1].split('AND _val_')
ql[-2] = qla[0]
ql[-1] = qla[1]
执行
if __name__ == '__main__':
url = 'www.baidu.com'
a = 2
b = run_get(url)
q_list(run_get(url))
#或
#q_list(b)
get_rqq(a)
#下面可以继续写函数