首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python中的延迟

python中的延迟
EN

Stack Overflow用户
提问于 2011-05-04 17:55:36
回答 3查看 1.5K关注 0票数 0

我在python上创建了一个问答游戏,基本上用户回答一些我随机编造的问题,然后按回车键,它会说“计算你的智能”,并在你的屏幕上显示一个随机数字。问题是,每次用户按回车键时,它都会说“计算你的智能度”,并同时显示数字。我想知道如何在开始下一段代码/行/脚本之前添加延迟。

到目前为止,以下是我的代码

代码语言:javascript
复制
import os
import time
a = raw_input("how old is I?:")
w = raw_input("How many ants are in the world?:")
e = raw_input("why am i asking so many questions:")
s = raw_input("Are mcdonalds food healthier than pizza huts?:")
o = raw_input("Are you fat:")
m = raw_input("show me examples of random:")
e = raw_input("how to eat a chicken without a chicken?:")
e = raw_input("Can you park in reverse while driving forwards while flying?:")
os.system('cls')
print "----------------------"
print "here are your answers!"
print a
print w
print e
print s
print o
print m
print e
print e
print "----------------------------------------------------------"
print 'now calculating smartness:'
print "Your smart level is:"
import random
print random.randint(1,100)
print "----------------------------------------------------------"
print "aw c'mon you can do better than that!!!!"
print "----------------------------------------------------------"
raw_input("Press enter to quit the game")

谢谢你,谢谢。:)

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-05-04 17:58:20

time module's sleep()

此外,由于某些原因,您已经导入了它。

票数 2
EN

Stack Overflow用户

发布于 2011-05-04 17:59:08

使用time.sleep(secs),查看此处:http://docs.python.org/library/time.html#time.sleep

票数 1
EN

Stack Overflow用户

发布于 2011-05-04 17:59:45

你在找time.sleep()

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5881605

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档