天天看点

打印当前日期&时间

打印当前日期&时间

import datetime

time_stamp = datetime.datetime.now()

print "time:    " + time_stamp.strftime('%Y.%m.%d-%H:%M:%S')   #strftime可以自定义时间的输出格式
#输出为
time_stamp       2017.02.19-14:03:20