Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Python 中获取文件的修改日期/时间?
os.path.getmtime(filepath)
或者
os.stat(filepath).st_mtime
形成:
import time print time.strftime("%m/%d/%Y %I:%M:%S %p",time.localtime(os.path.getmtime(fname)))