我有这个json数据https://pastebin.com/W422EtLn,返回表单关键字工具.ioapi,需要提取文本文件中的所有字符串,我的实际python代码是:
#http://keywordtool.io/api/documentation
def get_data(keyword):
url = 'http://api.keywordtool.io/v1/search/google?apikey=[api]&keyword={keyword}&country={country}&language={language}&output=json'\
.format(keyword=keyword, country='it', language='it')
data = json.loads(urllib2.urlopen(url).read())
pprint.pprint(data)
get_data('roma')
需要输出>
^{pr2}$
如果您只想从json中的“results”中“提取所有字符串元素”:
输出:
^{pr2}$相关问题 更多 >
编程相关推荐