import pdfplumber
import pandas as pd
#打开pdf文件
with pdfplumber.open(filePath) as pdf:
first_page = pdf.pages[0]
text = first_page.extract_text()
print(text)
#读取第二页表格数据
second_page = pdf.pages[1]
#在第二页提取表格
table = second_page.extract_tables()
for t in table:
df = pd.DataFrame(t[1:],columns=t[0])
#打印
print(df)
![待识别的pdf中表格](https://img-blog.csdnimg.cn/20200414081127585.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3RvbmUxMTI4,size_16,color_FFFFFF,t_70#pic_center)