I have a directory containing files named like so:
2018-07-14
2018-07-12
2018-07-17
Right now I am iterating over all those files like so:
from pathlib import Path
def data_generator(my_dir):
data_path = Path(my_dir)
for path in data_path.iterdir():
print(path)
Is there a simple to make sure I iterate on the files in order using their name as key, from oldest to most recent?