简体   繁体   English

类似的句子与 python like bash with jq

[英]similar sentence with python like bash with jq

I'm trying to traslate shell script bash to pyhton.我正在尝试将 shell 脚本 bash 转换为 pyhton。 I use jq to extract fileds of json response but with jsonresponse I can't do it with python.我使用 jq 来提取 json 响应的文件,但是使用 jsonresponse 我不能用 python 来做。 Someone knows?有人知道吗? My bash line我的 bash 线

jq -r '.search_objects[].price' file

I'm trying with我正在尝试

print(jsonResponse["search_objects"]["price"])

But fails :-(但失败了:-(

Maybe this也许这

HTTP requests and JSON parsing in Python Python 中的 HTTP 请求和 JSON 解析

import json

data = json.loads(jsonResponse)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM