我们在读取文件夹下面的文件时,有时是希望能够按照相应的顺序来读取,但是 file_lists=os.listdir()返回的文件名不一定是顺序的,也就是说结果是不固定的。就比如读取下面这些文件,希望能够按照图中的顺序进行读取,但是
得到的结果却是这样:
['Comprehensive Risk Report_May 10_ 2019 9-00-39 AM 314.html',
'Comprehensive Risk Report_May 11_ 2019 9-00-40 AM 031.html',
'Comprehensive Risk Report_May 12_ 2019 9-00-42 AM 145.html',
'Comprehensive Risk Report_May 13_ 2019 9-00-43 AM 490.html',
'Comprehensive Risk Report_May 14_ 2019 9-00-13 AM 544.html',
'Comprehensive Risk Report_May 15_ 2019 9-00-23 AM 408.html',
'Comprehensive Risk Report_May 16_ 2019 9-00-34 AM 028.html',
'Comprehensive Risk Report_May 17_ 2019 9-00-36 AM 892.html',
'Comprehensive Risk Report_May 1_ 2019 9-00-05 AM 861.html',
'Comprehensiv