我有以下代码:
i = 0
numbers = []
while i < 6:
print ("At the top i is %d" % i)
numbers.append(i)
i = i + 1
print ("Numbers now: ", numbers)
print ("At the bottom i is %d" % i)
print ("The numbers: ")
for num in numbers:
print (num)
如果我导入sleep
,它会降低速度,但我怎么能暂停它以便在我想要的时候继续进行?
答案 0 :(得分:1)
只需将input()
添加到您希望暂停的位置。
i=0
numbers = []
while i < 6:
print("At the top i is %d" % i)
numbers.append(i)
i = i + 1
print("Numbers now: ", numbers)
print("At the bottom i is %d" % i)
input() # add it here for example.
print("The numbers: ")
for num in numbers:
print(num)