其他分享
首页 > 其他分享> > json命令

json命令

作者:互联网

from io import BytesIO

import requests
import pdfplumber

req = requests.get("https://www1.hkexnews.hk/listedco/listconews/sehk/2020/0124/2020012400942_c.pdf")

with pdfplumber.load(BytesIO(req.content)) as pdf:
    print(pdf.pages[0].extract_text())

 

json.dump(infors_li,open("/Users/dengxinkaiacca163.com/Desktop/机器学习数据/1.json","w"))
s_str = json.dumps(a,ensure_ascii=False)

 

  #下载pdf
import json

infors_li = [{"k1": "v1"}, {"k2": "v2"}, {"k3": "v3"}, {"k4": "v4"}]
with open("demo.json", "w") as f:
    json.dump(infors_li, f, indent=4)

 

 

标签:dump,li,命令,json,import,pdf,infors
来源: https://www.cnblogs.com/dengxinkai/p/16492609.html