您现在的位置是:首页 » python编程资讯
资讯内容
Python基础练习实例9(等待1秒输出)
极客小将2020-11-12-
题目:暂停一秒输出。
程序分析:使用 time 模块的 sleep() 函数。
题目:暂停一秒输出。
程序分析:使用 time 模块的 sleep() 函数。
程序源代码:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
myD = {1: 'a', 2: 'b', 3: 'c', 4: 'd'}
for key, value in dict.items(myD):
print key, value
time.sleep(1) # 暂停 1 秒
以上实例输出结果为(会有停顿效果):
1 a
2 b
3 c
4 d
本站部分内容转载自网络,如有侵权请联系管理员及时删除。