Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,939 questions

51,876 answers

573 users

How to get access, modification and creation time of a text file in Python

1 Answer

0 votes
from os import path
from datetime import date

at = path.getatime("d:\data.txt")
mt = path.getmtime("d:\data.txt")
ct = path.getctime("d:\data.txt")

at = date.fromtimestamp(at)
mt = date.fromtimestamp(mt)
ct = date.fromtimestamp(ct)

print("access time: ", at)
print("modification time: ", mt)
print("creation time: ", ct)


'''
run:
 
access time:  2018-06-13
modification time:  2018-09-29
creation time:  2018-06-09

'''

 



answered Nov 14, 2018 by avibootz

Related questions

1 answer 232 views
1 answer 119 views
1 answer 106 views
106 views asked Aug 14, 2023 by avibootz
1 answer 187 views
1 answer 175 views
175 views asked Jun 17, 2016 by avibootz
...