0
点赞
收藏
分享

微信扫一扫

python作业第十例:暂停一秒输出,并格式化当前时间。

老罗话编程 2022-02-04 阅读 201
python
import time
 
print (time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
 
# 暂停一秒
time.sleep(1)
 
print (time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))

Python中 time strftime() 函数用于格式化时间,返回以可读字符串表示的当地时间,格式由参数 format 决定。

举报

相关推荐

0 条评论