programming-examples/python/_Basics/Sort files by date.py

6 lines
122 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
import glob
import os
files = glob.glob("*.txt")
files.sort(key=os.path.getmtime)
print("\n".join(files))