在 python 中使用 unirest 从列表循环
Loop from list using unirest in python
我希望循环打印列表中每个项目的同义词
myList = ["First", "Second", "Third"]
尝试了几种循环方法都没有成功,请帮忙
要手动 1 对 1 打印它们,命令是
response = unirest.get("https://wordsapiv1.p.mashape.com/words/first/synonyms", headers={ "X-Mashape-Key": "**MY -Mashape-Key", "Accept": "application/json" } )
response.body <===这将打印单词 "first"
的同义词
我如何循环打印列表中所有单词的正文?
谢谢
试试这个
for word in myList
response = unirest.get("https://wordsapiv1.p.mashape.com/words/" + word + "/synonyms", headers={ "X-Mashape-Key": "API_KEY", "Accept": "application/json" } )
print response.body
我不知道 Python,但从它的文档来看,它似乎应该可以工作。
我希望循环打印列表中每个项目的同义词
myList = ["First", "Second", "Third"]
尝试了几种循环方法都没有成功,请帮忙
要手动 1 对 1 打印它们,命令是
response = unirest.get("https://wordsapiv1.p.mashape.com/words/first/synonyms", headers={ "X-Mashape-Key": "**MY -Mashape-Key", "Accept": "application/json" } )
response.body <===这将打印单词 "first"
的同义词我如何循环打印列表中所有单词的正文? 谢谢
试试这个
for word in myList
response = unirest.get("https://wordsapiv1.p.mashape.com/words/" + word + "/synonyms", headers={ "X-Mashape-Key": "API_KEY", "Accept": "application/json" } )
print response.body
我不知道 Python,但从它的文档来看,它似乎应该可以工作。