From cd4cd32a9c609db04a5d979e756de13418466a41 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 27 Apr 2021 12:39:48 +0200 Subject: [PATCH] Remove Python syntax error from merge multiple PDFs --- Python projects/Merge Multiple PDF/source-code.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Python projects/Merge Multiple PDF/source-code.py b/Python projects/Merge Multiple PDF/source-code.py index 65f57bd..952295b 100644 --- a/Python projects/Merge Multiple PDF/source-code.py +++ b/Python projects/Merge Multiple PDF/source-code.py @@ -2,14 +2,8 @@ import os #var = os.getcwd() For extracting from enother folder merger = PdfFileMerger() -for items in os.listdir(): - if items.endswith('.pdf') - merger.append(items) +for filename in os.listdir(): + if filename.endswith('.pdf'): + merger.append(filename) merger.write("Final_pdf.pdf") -merger = PdfFileMerger() -fin = file(originalFile, 'rb') -merger.append(PdfFileReader(fin)) -fin.close() -os.remove(originalFile) merger.close() -