timestamp()
在Python3中引入。
对python 2使用下面的代码。
from datetime import datetime
date_dob = datetime.now()
print date_dob
#print dir(date_dob) ## To list all the attributes
date_sec_str = date_dob.strftime("%s.%f")
date_sec_float = float(date_sec_str)
a = int(date_sec_float*1000)
print a
结果:
2019-03-15 15:32:05.869709
一兆五千五百二十六亿六千三百九十二万五千八百六十九