简体   繁体   English

如何在Python中获得精确的文件创建时间?

[英]How to gain the precise file creation time in Python?

I know that 我知道

time.time() 

can be used to make the time system more precise and 可用于使时间系统更加精确和

time.ctime(os.stat("c:/a1.txt").st_ctime)

can be used to get the creation time of the file. 可用于获取文件的创建时间。 But it can the precision is too low, only to the unit of second. 但是它的精度可能太低,仅以秒为单位。

Can these two ways be combined together? 这两种方式可以结合在一起吗?

使用os.stat(“ C:/a1.tif”)。st_ctime_ns可以获取纳秒级

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM