Ai
2 Star 1 Fork 1

望曦开源团队/Python案例合集

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
StopWatch.py 513 Bytes
一键复制 编辑 原始数据 按行查看 历史
NineSenz-九练 提交于 2023-04-22 00:00 +08:00 . 秒表
import time
print('按下回车开始计时,按下 Ctrl + C 停止计时。')
while True:
input("") # 如果是 python 2.x 版本请使用 raw_input()
starttime = time.time()
print('开始')
try:
while True:
print('计时: ', round(time.time() - starttime, 0), '秒')
time.sleep(1)
except KeyboardInterrupt:
print('结束')
endtime = time.time()
print('总共的时间为:', round(endtime - starttime, 2),'secs')
break
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/wangxios/workspace_Python.git
git@gitee.com:wangxios/workspace_Python.git
wangxios
workspace_Python
Python案例合集
master

搜索帮助