import os
import time
file='/Volumes/Leopard/Users/Caroline/Desktop/1.mp4'
os.path.getatime(file) #输出最近访问时间1318921018.0
os.path.getctime(file) #输出文件创建时间
os.path.getmtime(file) #输出最近修改时间
time.gmtime(os.path.getmtime(file)) #以struct_time形式输出最近修改时间
os.path.getsize(file) #输出文件大小(字节为单位)
os.path.abspath(file) #输出绝对路径'/Volumes/Leopard/Users/Caroline/Desktop/1.mp4'
os.path.normpath(file) #输出'/Volumes/Leopard/Users/Caroline/Desktop/1.mp4'
Python OS使用
最新推荐文章于 2023-04-17 21:28:03 发布