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中显得更慢)的主要内容,如果未能解决你的问题,请参考以下文章