嗨,我目前正在使用Python3.X运行以下代码:
import requests
jurisdiction = 'us'
name = 'netflix'
limit = 1
r = requests.get('https://opencorporates.com/reconcile?query={%22query%22:%22' + name + '%22,%20%22limit%22:' + str(limit) + ',%20%22jurisdiction_code%22:%22' + jurisdiction + '%22}')
print(type(r))
print(r.text)
它的输出是
<class 'requests.models.Response'>
{"result":[{"id":"/companies/gb/12022722","name":"AMAZON-UK LIMITED","type":[{"id":"/organization/organization","name":"Organization"}],"score":69.0,"match":false,"uri":"https://opencorporates.com/companies/gb/12022722"}],"duration":157.957621}
我希望能够从响应中访问公司名称,然后将其添加到列表中。因此,我可以迭代一堆名称/辖区,并在最后有一个列表,我可以导出到csv(或任何东西)。你知道吗
我认为使用到.json或者json.dump文件或者类似的东西可能有用,但我不知道具体怎么做?如果需要的话,我愿意进口更多的包装,如熊猫等。你知道吗
你可以试试这个。你知道吗
导入json,您可以读取公司名称,如本文件:你知道吗
相关问题 更多 >
编程相关推荐