我从代码中摘录了问题仍然存在的地方。我相信这是由于我的slow_type函数引起的,但是在对话框“慢速键入”时,即使在输入出现之前,我的输入也将采用“ slow_type”期间键入的任何值。我希望输入只能在slow_type函数完成后才能输入。我该怎么办?
import time
import sys
def slow_type(line, speed):#You input the dialogue and speed(smaller = faster)
for l in line:
sys.stdout.write(l)
sys.stdout.flush()
time.sleep(speed)
time.sleep(.5)
NL1 = "Huh, I see you finally came. "
NL2 = "You know I sent you that message a long time ago.\n"
NL3 = "But I guess you are here now, and that's what matters. "
NL4 = "So...\n"
NL5 = "\n\t\t\t\tAre you ready?\n\n"
slow_type(NL1, .05)
slow_type(NL2, .05)
slow_type(NL3, .05)
slow_type(NL4, .2)
slow_type(NL5, .05)
print("\t\t1:Yes, I am. 2:Who are you? 3:No, I am leaving.\n")
first_choice = input("\t\t\t\t ").lower()
我正在使用Windows 10 cmd。