标签:代码 tst val col ice 存储 value ram imp
1.首先安装库 pdfminer3k
2.几个类
#读取解析pdf文件 报错xxxx from io import StringIO from pdfminer.pdfinterp import PDFResourceManager,process_pdf from pdfminer.converter import TextConverter from pdfminer.layout import LAParams pdf_file = open(r‘长恨歌.pdf‘,‘rb‘) rsrcmgr = PDFResourceManager() retstr = StringIO() laparams = LAParams() device = TextConverter(rsrcmgr=rsrcmgr,outfp=retstr,laparams=laparams) process_pdf(rsrcmgr=rsrcmgr,device=device,fp=pdf_file) device.close() content = retstr.getvalue() retstr.close() pdf_file.close() print(content)
标签:代码 tst val col ice 存储 value ram imp
原文地址:https://www.cnblogs.com/sunflying/p/13418441.html