import pdfplumberit
pdf=pdfplumber.open(',,,,,,,.pdf')table
first_page=pdf.pages[0]pdf
print(first_page.extract_text()) #打印第一页内容import
#提取其中的表格im
first_page.extract_table() #提取这一页的第一个表格tab
first_page.extract_tables() #提取这一页内的全部表格join
#提取表格时设置表格参数参数
first_page.extract_table(ab
table_settings={'表格
vertical_strategy':'text',
'horizontal_strategy':'text'
}
)
if not ''.join( [ str(i) for i in first_page.extract_text( ) ] ) == '' : #这行不为空则继续执行如下操做
''.join( [ str(item) if item else '' for item in i[:3] )