LYF511 发表于 2018-12-27 18:57:54

怎么用python获取当前时间?

怎么用python获取当前时间?

heidern0612 发表于 2018-12-27 19:05:23

本帖最后由 heidern0612 于 2018-12-27 19:06 编辑

import time

print(time.strftime('%Y.%m.%d',time.localtime(time.time())))         #年月日

print(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))   #年月日时分秒

LYF511 发表于 2018-12-27 19:07:42

heidern0612 发表于 2018-12-27 19:05


当前时间和具体时间点呢?

heidern0612 发表于 2018-12-27 19:08:30

LYF511 发表于 2018-12-27 19:07
当前时间和具体时间点呢?

头一个print 年月日。

第二个print年月日时分秒。

千锦襄 发表于 2018-12-27 19:23:23

学习了!
页: [1]
查看完整版本: 怎么用python获取当前时间?