无会员的办公技巧——office
1. 合并多个pdf
import os
from PyPDF2 import PdfMergertarget_path = '1'
pdf_lst = [f for f in os.listdir(target_path) if f.endswith('.pdf')]
pdf_lst = [os.path.join(target_path, filename) for filename in pdf_lst]file_merger = PdfMerger()
for pdf in pdf_lst:file_merger.append(pdf) # 合并pdf文件file_merger.write("merge.pdf")