如何在python中制作一些小延迟?
我希望在之后3秒钟显示某些内容,然后让用户输入内容。
这就是我所拥有的
print "Think of a number between 1 and 100"
print "Then I shall guess the number"
我想要延迟
print "I guess", computerguess
raw_input ("Is it lower or higher?")
答案 0 :(得分:3)
这应该有效。
import time
print "Think of a number between 1 and 100"
print "Then I shall guess the number"
time.sleep(3)
print "I guess", computerguess
raw_input ("Is it lower or higher?")
答案 1 :(得分:2)
试试这个:
import time
print "Think of a number between 1 and 100"
print "Then I shall guess the number"
time.sleep(3)
print "I guess", computerguess
raw_input ("Is it lower or higher?")
数字3
表示暂停的秒数。阅读here。
答案 2 :(得分:2)
import time
print "Think of a number between 1 and 100"
print "Then I shall guess the number"
time.sleep(3)
print "I guess", computerguess
raw_input ("Is it lower or higher?")