![](/img/trans.png)
[英]How to use Python to search for file by name, find the latest modified, find next file and repeat steps?
[英]How to find latest created file not latest modified in Python
我想找到哪个是最新创建的文件,而不是最新修改的文件。 我看到了几个答案,但没有解决我的问题。 因此,修改后的文件不应影响结果。 这是我到目前为止的代码。 但
import glob
import os
list_of_files = glob.glob('/PDF Parsing/*')
# list_of_files = os.listdir('PDF Parsing')
print(list_of_files)
latest_file = max(list_of_files, key=os.path.getctime)
print (latest_file)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.