一秒一秒地打印列表中的每个项目(PYTHON)
假设我有一个一秒一秒地打印列表中的每个项目(PYTHON),python,Python,假设我有一个n项目列表 我想一个接一个地打印,中间有一秒钟 说n=5: list = [a,b,c,d,e] 我要“打印列表”做什么 我试过摆弄计时器的功能,但我不知道到底该怎么做 x = [a,b,c,d,e,f] for i in x print x PSC:\PYthon\A06>PYthon-i test.py使用: 有关时间.睡眠的帮助: sleep(seconds) Delay execution for a given number of seconds. Th
n
项目列表
我想一个接一个地打印,中间有一秒钟
说n=5
:
list = [a,b,c,d,e]
我要“打印列表”做什么
我试过摆弄计时器的功能,但我不知道到底该怎么做
x = [a,b,c,d,e,f]
for i in x
print x
PSC:\PYthon\A06>PYthon-i test.py
使用:
有关时间.睡眠的帮助:
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
使用可在给定时间内暂停执行:
import time
x = ['a', 'b', 'c', 'd', 'e', 'f']
for i in x:
print i
time.sleep(1)
time.sleep()
接受一个数字参数,即“睡眠”的秒数
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
import time
x = ['a', 'b', 'c', 'd', 'e', 'f']
for i in x:
print i
time.sleep(1)