猫史档案馆


【Python作品分享】钟表【作品秀】

用户:ALFA_ROMEOALFA_ROMEO查看:0 回复:1 评论:0 创建时间:2020-09-26T20:26:28


【作品展示】

center_image

 

【作品介绍】

时间表

 

【作品源代码】

import time

def st(h,M,s):
    return '%02d:%02d:%02d'%(h,M,s)

def main():
    while 1:
        t = time.localtime()
        h = t[3]
        M = t[4]
        s = t[5]
        print(st(h,M,s),end = '\r',flush=True)
        time.sleep(1)
main()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
蒟蒻OIer1048576蒟蒻OIer1048576

import time


def st(h, M, s):
    return '%02d:%02d:%02d' % (h, M, s)


def main():
    while 1:
        t = time.localtime()
        h = t[3]
        M = t[4]
        s = t[5]
        print(st(h, M, s), end='',flush=True)
        time.sleep(1)
        print(end='\r')

main()

点赞0


评论