Python(如何使文本在python shell中显得更慢)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python(如何使文本在python shell中显得更慢)相关的知识,希望对你有一定的参考价值。

我正在尝试编写游戏代码,但我仍然坚持尝试在python shell中使打印速度变得更慢我感谢所有帮助这里是目前为止的代码

print ("welcome to the music guessing game")
print (" begin?")

print (" first of all lets go through the rules")

print (" You have three 3 lives to answer each song in this game")
print (" If you get it on the first turn you gain 3 points")
print (" if you get it on the second try you gain 1 point")
print ( " If you get it wrong again you lose one life and it proceeds to the next question")
print (" One major rule have fun while playing")


username=input (" what is your username")
print ("Is this your name ?",username)

password=input (" Enter your password please")
print (" password gained",password)

print ("Checking the data files")
print ("10%")
print ("20%")
print ("30%")
print ("40%")
print ("50%")
print ("60%")
print ("70%")
print ("80%")
print ("90%")
print  ("100%")
print (" check complete")

import random
def fifty_fifty():
        "return 0 or 1 or 2 or 3 or 4 or 5 or 5 with 50% chance each"
        return random.randrange

print (" High Scores!!!!!")

print ("[DEV]LB123 score 1200")
print (" PewDiePie score 420")
print (" Callmekevin score 68")
print ("[BOT] Tseries score 0")



option=input ("would you like to play")
print ("would you like to play "+ option +"?")

我从https://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/io.html获得了这些信息

print (" okay then lets begin ")



print (" Round One " )


print (" Lets begin " )

print ("3")
print ("2")
print ("1")



print (" 'N_ Te_rs L_ft _o _r_'")

if input (" No Tears Left To Cry")
 print ("3 points")

elif input (" no answer")
print (" 1 life gone 2 remain") 

所以问题是,如何在python shell中使文本显得更慢?谢谢

答案

您可以在代码中添加sleep

另外,欢迎来到SO!将来,请正确格式化您的代码,以便它能够正确显示。你可以在this meta post上看到各种方式

以上是关于Python(如何使文本在python shell中显得更慢)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Python 中使用管道分隔符拆分文本文件,然后使列数等于属性值的数量?

python如何删除已在shell中导入的模块?

除非我在shell窗口中按ENTER键,否则不会使用python创建新的文本文件

如何使 Checkbutton/box 单击时更改文本文件? (使用 Python 和 tkinter 库)[关闭]

pymysql.connect 命令使 Windows 上的 python shell 崩溃

Windows 上的 Python 2.6:如何使用“shell=True”参数终止 subprocess.Popen?