Python: Sort files by date
Python Basic: Exercise-70 with Solution
Write a Python program to sort files by date.
import glob import os files = glob.glob("*.txt") files.sort(key=os.path.getmtime) print("\n".join(files))
result.txt temp.txt myfile.txt mynewtest.txt mytest.txt abc.txt test.txt
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.