From 0d1f32c75cc2c7703fc03843a58e3e4377fdc93d Mon Sep 17 00:00:00 2001 From: xiao Date: Mon, 23 Mar 2026 14:07:18 +0800 Subject: [PATCH] =?UTF-8?q?Reference:=20=E5=BF=BD=E7=95=A5=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=92=8C=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4extract=5Fpdf.py=E8=B7=9F=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Reference/.gitignore | 10 ++++++++++ Reference/extract_pdf.py | 29 ----------------------------- 2 files changed, 10 insertions(+), 29 deletions(-) delete mode 100644 Reference/extract_pdf.py diff --git a/Reference/.gitignore b/Reference/.gitignore index 27e351a..9ba1771 100644 --- a/Reference/.gitignore +++ b/Reference/.gitignore @@ -1 +1,11 @@ EVT/ + +# Script files +*.py +*.sh +*.bat + +# Cache files +__pycache__/ +*.pyc +*.cache diff --git a/Reference/extract_pdf.py b/Reference/extract_pdf.py deleted file mode 100644 index b24d35d..0000000 --- a/Reference/extract_pdf.py +++ /dev/null @@ -1,29 +0,0 @@ -import pdfplumber -import sys - - -def extract_pdf_text(pdf_path, output_path): - try: - with pdfplumber.open(pdf_path) as pdf: - text = "" - for i, page in enumerate(pdf.pages): - page_text = page.extract_text() - if page_text: - text += f"=== Page {i + 1} ===\n" - text += page_text + "\n\n" - - with open(output_path, "w", encoding="utf-8") as f: - f.write(text) - print(f"Extracted {len(pdf.pages)} pages from {pdf_path}") - return True - except Exception as e: - print(f"Error extracting {pdf_path}: {e}") - return False - - -if __name__ == "__main__": - # Extract CH390 datasheet - extract_pdf_text("CH390DS1.PDF", "CH390DS1.txt") - - # Extract STM32F103C8 datasheet - extract_pdf_text("stm32f103c8.pdf", "stm32f103c8.txt")