在获取API响应之后,将其转换为json。那么我该如何回忆起那个json。
在未来,它将存储在一个数据库中,但目前CSV是可以的。我试过CSV的作者,但没有成功。
site = 'http://www.micxxxxnk.com'
output = analyze(site, analyze_headings=True, analyze_extra_tags=True)
fields = ['pages']
data = output["pages"]
with open("output.json", "w", encoding = 'utf-8') as file:
json.dump(output, file, indent=4)\
样本输出:
{
"pages": [
{
"url": "http://www.mixxxxink.com",
"title": "mixxxxnk: ai-driven technology for solving real life problems",
"description": "create amazing experiences, verify users at scale and automate your document-based workflow with ai tech built for a remote world.",
"word_count": 653,
"keywords": [
[
17,
"identity"
],
[
13,发布于 2022-06-28 03:11:51
json.dump()正在将python对象序列化为一个有效的json格式化流到您的json文件中,因此您对此没有问题。
https://stackoverflow.com/questions/72780279
复制相似问题