复杂的Json解析器

时间:2017-07-30 08:45:40

标签: json list dictionary

我使用python 2.7.12从www.quotes.rest/qod.json?category=inspire中提取当天的引用。我得到的响应是如下所示的json格式。我现在如何提取报价以及版权信息。感谢

{     "成功":{         "总计":1     },     "内容":{         "报价":[             {                 "引用":"超出预先设定的限制!",                 "长度":" 39",                 "作者":" Lorii Myers",                 "标签":[                     "信心&#34 ;,                     "激发&#34 ;,                     "限制&#34 ;,                     "自我完善"                 ]                 "类别":"启发",                 " date":" 2017-07-30",                 "永久链接":" https://theysaidso.com/quote/JRlytEdrKdV8iSCZCSEh6weF/lorii-myers-extend-beyond-your-preconceived-limits",                 "标题":"鼓舞人心的当天报价",                 "背景":" https://theysaidso.com/img/bgs/man_on_the_mountain.jpg",                 " id":" JRlytEdrKdV8iSCZCSEh6weF"             }         ]         " copyright":" 2017-19 theysaidso.com"     } }

如何提取报价和版权值。感谢

1 个答案:

答案 0 :(得分:0)

得到它.... quote_ = data ['contents'] ['引用'] [0] ['quote']报价和           copyright_ = data ['contents'] ['copyright']。感谢