import pdfplumber 
import re
def pdf_read():
    pdf=pdfplumber.open('文件路径'")#文件路径,读取文件
    page0=pdf.pages[11] #指定页数
    tables=page0.extract_tables()#获得该页的表格
    texts=page0.extract_text()#获得text文本值

pdfplumber 缺省通过表格线来区分行和列,所以下列情况是无法提取出表格的:
* 你的表格是图片,通过选择可以确定是否图片
* 你的表格不是用线来分隔,或者分隔不全,例如列用线,行没线
这种情况下,你就需要尝试:
page0.extract_tables(table_settings={})

相关文章:

  • 2022-12-23
  • 2021-08-14
  • 2021-07-02
  • 2021-04-01
  • 2021-09-16
  • 2021-09-22
  • 2022-03-05
  • 2021-05-15
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2021-08-15
  • 2022-01-01
  • 2022-12-23
相关资源
相似解决方案