即使现实总是不尽人意,也永远无法阻碍我们变得优秀。

python3  循环输出当前时间。

题目 暂停一秒输出(使用 time 模块的 sleep() 函数)。循环输出当前时间。

代码:

import time
while True:
 time.sleep(1)
 print(time.strftime("%Y-%m-%d %H:%M:%S ",time.localtime(time.time())))

结果:

 

posted @ 2019-05-27 14:48  依概率收敛于你  阅读(1576)  评论(1编辑  收藏  举报