晚上好,
我想从此输出中刮取“值”:
{
"checkout":
{
"completed_at": null,
"created_at": "2020-02-27T00:32:40+01:00",
"currency":"EUR",
"presentment_currency":"EUR",
"customer_id":2929596792912,
"customer_locale":"de"
...
依此类推。...
我的尝试:
import json
Json = json.loads(info.text)
currency= Json1.get("currency")
print(currency
但是打印答案时我只得到None
使用json
库解析输入后,您将拥有一个python字典。
get("currency")
返回None
的原因是,键currency
在字典的顶层不存在。
如果您尝试
currency = Json.get("checkout").get("currency")
您应该获得值EUR