【发布时间】:2014-09-17 07:24:12
【问题描述】:
有一个网站 (http://xisbn.worldcat.org/xisbnadmin/doc/api.htm) 提供多种格式的 API,包括 XML、CSV、JSON 和称为“python”的东西。我假设这与 Python 编程语言有关,但是如何呢?输出如下所示:
{
'stat':'ok',
'list':[{
'url':['http://www.worldcat.org/oclc/177669176?referer=xid'],
'publisher':'O\'Reilly',
'form':['BA',
'DA'],
'lccn':['2004273129'],
'lang':'eng',
'city':'Sebastopol, CA',
'author':'by Mark Lutz and David Ascher.',
'ed':'2nd ed.',
'year':'2003',
'isbn':['0596002815'],
'title':'Learning Python',
'oclcnum':['177669176',
'222927677',
'249274099',
'253402825',
'301161087',
'438280230',
'442197411',
'464709193',
'492988633',
'54619668',
'55847258',
'614957020',
'644729085',
'760707144',
'772683553',
'802989466',
'850841661',
'851226517',
'875412584']}]}
这对我来说看起来像 JSON,但 JSON 输出虽然相似,但却是这样的:
{
"stat":"ok",
"list":[{
"url":["http://www.worldcat.org/oclc/177669176?referer=xid"],
"publisher":"O'Reilly",
"form":["BA",
"DA"],
"lccn":["2004273129"],
"lang":"eng",
"city":"Sebastopol, CA",
"author":"by Mark Lutz and David Ascher.",
"ed":"2nd ed.",
"year":"2003",
"isbn":["0596002815"],
"title":"Learning Python",
"oclcnum":["177669176",
"222927677",
"249274099",
"253402825",
"301161087",
"438280230",
"442197411",
"464709193",
"492988633",
"54619668",
"55847258",
"614957020",
"644729085",
"760707144",
"772683553",
"802989466",
"850841661",
"851226517",
"875412584"]}]}
“python”示例没有解析为有效的 JSON,那么它是什么?如何在 Python 中解码这些信息?
【问题讨论】: