Files
my_wiki/raw/期货/01-基本分析逻辑/焦煤日报/scripts/extract_pdf_sections.py
T

10 lines
338 B
Python

import fitz
p = r'C:\Users\12637\Desktop\hermes\焦煤\基础知识\焦煤交易手册.pdf'
doc = fitz.open(p)
for start,end in [(5,10),(11,18),(19,28)]:
print(f'===PAGES {start}-{end}===')
for i in range(start-1,end):
text = doc.load_page(i).get_text('text')
print(f'---PAGE {i+1}---')
print(text[:6000])