Return reference numbers in a list
This commit is contained in:
parent
5e95a501a3
commit
e514156371
21
projekt.py
21
projekt.py
@ -0,0 +1,21 @@
|
|||||||
|
import fitz
|
||||||
|
import pdfplumber
|
||||||
|
my_path = r"C:\Users\DELL\Downloads\A-24VU-00511.PDF.pdf"
|
||||||
|
|
||||||
|
with fitz.open(my_path) as doc:
|
||||||
|
order_numbers = []
|
||||||
|
order_dates = []
|
||||||
|
buyers = []
|
||||||
|
|
||||||
|
for page in doc:
|
||||||
|
text = page.get_text("text")
|
||||||
|
|
||||||
|
if "Your ref. no. PO" in text:
|
||||||
|
parts = text.split("Your ref. no. PO")
|
||||||
|
for part in parts[1:]: #idziemy od 2 elementu, żeby nie brać tekstu
|
||||||
|
order_number = part.split()[0].strip()
|
||||||
|
order_numbers.append(order_number)
|
||||||
|
|
||||||
|
|
||||||
|
print("Reference numbers: ", order_numbers)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user