计算一个pdf文档里的表格数量
tabcount = 0
pdf = pdfplumber.open(path)
for page in pdf.pages:
page.extract_table()
tabcount += 1
这样对吗
计算一个pdf文档里的表格数量
tabcount = 0
pdf = pdfplumber.open(path)
for page in pdf.pages:
page.extract_table()
tabcount += 1
这样对吗
你的程序对不对,你自己跑一下就知道了哈。
下面是我写的,供参考
import pdfplumber
path = r"filename.pdf"
tabcount = 0
with pdfplumber.open(path) as pdf:
for page in pdf.pages:
table = page.extract_tables()
tabcount += len(table)
print(tabcount)