Glob search files in date order?
问题 I have this line of code in my python script. It searches all the files in in a particular directory for * cycle *.log. for searchedfile in glob.glob("*cycle*.log"): This works perfectly, however when I run my script to a network location it does not search them in order and instead searches randomly. Is there a way to force the code to search by date order? This question has been asked for php but I am not sure of the differences. Thanks 回答1: To sort files by date: import glob import os