Search code examples
pythonfilemergepypdf

Python Select PDF File Parts and Merge into One


I've many PDF Files in One Folder. Two of files have same name end with _01 and _03 these number could be random. I want to merge these two files having same name into one PDF with the name the parts have. any Idea? Like story-writing_01.pdf, story-writing_02.pdf, game-changer_01.pdf, game-changer_09.pdf


Solution

  • I created List of files path and append them in dictionary with condition. if key is not in value then add in dictionary. which make exact pairs of two consective parts. which then i merged into pdf.