0

I was trying to write an image-to-PDF converter and I wrote one using the help of this answer: https://stackoverflow.com/a/45990883/13875145

I used this code:

import img2pdf
import glob

with open("name.pdf","wb") as f:
    f.write(img2pdf.convert(glob.glob("/path/to/*.jpg")))

This program sorts the images on the basis of "name", but I would like to sort the images on the basis of "date modified ascending"

Thanks for the help in advance

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Howard
  • 1
  • 2
  • This might help you with the sorting on the basis of date modified. https://stackoverflow.com/questions/168409/how-do-you-get-a-directory-listing-sorted-by-creation-date-in-python – Abhishek Jul 07 '21 at 05:50
  • Thankyou it worked – Howard Jul 07 '21 at 06:17

0 Answers0