Python使用glob查找文件夹中的最新文件

问题描述

我正在使用以下代码尝试在文件夹中查找最新文件。 但是我得到了一个有趣的角色 实际文件名为 G:\\foo\\example - YTD.zip

# Identify the file with the latest create timestamp
list_of_files = glob.glob('G:\\foo\\\\*.zip')
latest_file = max(list_of_files,key=os.path.getctime)

latest_file
'G:\\foo\\example � YTD.zip'

有人可以帮忙吗? 我是一个完整的 Python 新手,所以很感激这可能是一个菜鸟问题

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)