Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从upcdatabase.org API(Python)中获取特定数据_Python - Fatal编程技术网

如何从upcdatabase.org API(Python)中获取特定数据

如何从upcdatabase.org API(Python)中获取特定数据,python,Python,使用requests包,我试图访问upcdatabase.org API,只是为了得到要打印的返回数据的某一部分。返回的数据如下所示: { "upc": "5705831011120", "name": "Pink highlighter", "alias": "Highlighter", "description": "It's a pink highlighter. Here's some more information as well.", "b

使用requests包,我试图访问upcdatabase.org API,只是为了得到要打印的返回数据的某一部分。返回的数据如下所示:

{
    "upc": "5705831011120",
    "name": "Pink highlighter",
    "alias": "Highlighter",
    "description": "It's a pink highlighter. Here's some more information as 
well.",
    "brand": "Q-CONNECT",
    "msrp": 0.99,
    "status": 200,
    "error": false
}
我试图将名称打印出来,但它似乎是作为字符串而不是列表返回给python的。
感谢您的帮助。

这看起来像是JSON数据。你知道如何使用JSON吗?你为什么期待一份清单?您期望的是多个结果的列表,还是单个结果?你提出的确切要求是什么?请阅读。
raw=api_stuff();data=json.loads(原始);打印(数据['name'])