python 时间相关代码

import datetime

#打印当前时间
def printbar():
    nowtime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print("\n"+"=========="*8 + "%s"%nowtime)

 

posted @ 2022-03-04 14:52  cup_leo  阅读(36)  评论(0编辑  收藏  举报