明明安装了PyPDF2, 怎么还出现这个问题?
import os
import PyPDF2
from PyPDF2 import PdfFileMerger
target_folder = '/Users/ericlam3288/Desktop/test'
pdfs = []
#Find all pdf files in a folder
for file in os.listdir(target_folder):
if file.lower().endswith('.pdf'):
pdfs.append(file)
#PDFs are merged
merger = PdfFileMerger()
for pdf in pdfs:
merger.append(pdf)
#Output a merged pdf file
merger.write('Merged_2.pdf')
merger.close()