Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import os
from tkinter import Tk, filedialog
from datetime import datetime
创建一个 Tkinter 根窗口以便打开文件对话框
root = Tk()
root.withdraw() # 隐藏 Tkinter 根窗口
弹出文件对话框,允许用户选择多个 PDF 文件
pdf_files = filedialog.askopenfilenames(title="选择 PDF 文件", filetypes=[("PDF Files", "*.pdf")])
获取当前日期
current_date = datetime.now().strftime('%Y-%m-%d')
遍历每个选中的 PDF 文件
for pdf_file in pdf_files:
# 获取PDF文件名(不含路径和扩展名)
pdf_filename = os.path.splitext(os.path.basename(pdf_file))[0]
Beta Was this translation helpful? Give feedback.
All reactions