如何使用Python检查文件的上次访问时间?

要获取文件的修改时间,可以使用os.path.getmtime(path)。支持跨平台。

示例

>>> import os
>>> print os.path.getmtime('my_file.txt')
1505928275.3081832