酷代码 AI
菜单
全部AI  /  热门  /  AI写代码神器
服务商

写一段pythonpdf文件合并代码

```python import PyPDF2 def merge_pdfs(file_list, output): pdf_merger = PyPDF2.PdfMerger() for file in file_list: with open(file, 'rb') as f: pdf_merger.append(PyPDF2.PdfFileReader(f)) with open(output, 'wb') as f: pdf_merger.write(f) if __name__ == '__main__': file_list = ['文件1.pdf', '文件2.pdf', '文件3.pdf'] output = '合并后的文件.pdf' merge_pdfs(file_list, output) ``` [2024-06-21 17:50:33 | AI写代码神器 | 166点数解答]

相关提问