from PyPDF2 import PdfFileReader,PdfFileWriter 写pdf=PdfFileWriter() for i in range(1,5): 读pdf=PdfFileReader('{}.pdf'.format(i)) for j in range(读pdf.getNumPages()): 写pdf.addPage(读pdf.getPage(j)) with open('合并后的pdf文件.pdf','wb') as f: 写pdf.write(f)
from PyPDF2 import PdfFileReader,PdfFileWriter 写pdf=PdfFileWriter() for i in range(1,5): 读pdf=PdfFileReader('{}.pdf'.format(i)) for j in range(读pdf.getNumPages()): 写pdf.addPage(读pdf.getPage(j)) with open('合并后的pdf文件.pdf','wb') as f: 写pdf.write(f)