Answers for "how to get last modified date of a file in python"

1

python get date file last modified

import os, time
# Get file's Last modification time stamp only in terms of seconds since epoch 
modTimesinceEpoc = os.path.getmtime(filePath)
# Convert seconds since epoch to readable timestamp
modificationTime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(modTimesinceEpoc))
print("Last Modified Time : ", modificationTime )
Posted by: Guest on September-02-2021
0

python get last modification time of file

import os
time = os.path.getmtime("file.txt")

print(time) # 1600113737.82
Posted by: Guest on September-15-2020

Code answers related to "how to get last modified date of a file in python"

Python Answers by Framework

Browse Popular Code Answers by Language