所以我试图在json中列出元素,但我不知道会有多少,这取决于标记。你知道吗
我试过这个:
tag = "cat"
r = requests.get('https://danbooru.donmai.us/related_tag.json?query=' + tag)
j = json.loads(r.text)
dump = json.dumps(j, indent=2, sort_keys=True)
taglist = []
taglist.append(j["wiki_page_tags"][all][0])
if tag in dump:
print(f"{taglist}")
我想得到这样的结果
tag1
tag2
tag3
对不起,你的垃圾代码,谢谢你的帮助
这就是你要找的吗?你知道吗
完整示例:
印刷品:
相关问题 更多 >
编程相关推荐