指点成金-最美分享吧

登录

python获取时间

佚名 举报

篇首语:本文由小编为大家整理,主要介绍了python获取时间相关的知识,希望对你有一定的参考价值。

python获取时间

import datetime# 获得当前时间now = datetime.datetime.now()other_StyleTime = now.strftime("%Y-%m-%d %H:%M:%S")Y = now.strftime("%Y")M = now.strftime("%m")D = now.strftime("%d")print(Y, M, D)

获取时间的格式

"%Y-%m-%d %H:%M:%S"

以上是关于python获取时间的主要内容,如果未能解决你的问题,请参考以下文章