python文件屬性
發布時間: 2025-06-29 06:30:38
⑴ python如何獲取windows文件屬性的詳細信息
#已知文件名的情況下,可以用這個函數
def getFileInfo(filepath):
info = {}
if os.path.isfile(filepath):
info['TimeCreated'] = os.path.getctime(filepath)
info['TimeModified'] = os.path.getatime(filepath)
info['Size'] = os.path.getsize(filepath)
return info
熱點內容