希望仅从具有不同结构的多个PDF中提取特定数据
我已将所有pdf文件存储到发票文件夹中。 我尝试使用pdfminer库从pdf中提取数据
def extract_text(pdf_path):
text21 = ''
for page in extract_text_by_page(pdf_path):
text21 = text21 + str(page[:-1]) + ' '
return text21
inv = glob.glob(path+"/Invoice/*.pdf")
for i in inv:
print(i)
page = extract_text(i)
print(page)
data1 = str(page)
lan = len(data1)
x = re.search("Invoice Number:", page)
x1 = re.search("Invoice No:", page)
x2 = re.search("Bill No:" , page)
x3 = re.search("Bill:" , page)
if (x or x1 or x2 or x3):
if x:
yo = x.end()
elif x1:
yo = x1.end()
elif x2:
yo = x2.end()
elif x3:
yo = x3.end()
类似地,希望从发票PDF文件中附加发票日期、账单总金额。如何将所有值作为提取的值附加到单独的变量中,以供其他进程使用
使用pText
相关问题 更多 >
编程相关推荐