Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

datetime - Windows file creation date/time using python

I need to get a file creation date&time using python. I tried:

os.stat(r"path")[ST_CTIME]

But it is returning:

1263538277

This is not the creation date time. Is there a way to do it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Why not?

>>> import time
>>> time.ctime(1263538277)
'Fri Jan 15 04:51:17 2010'

Looks like a valid creation time to me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...