如何在一行中一次打印一个字符时输入输入?


0

我已经在Stack Exchange上看到一个关于如何一次打印一个字符的问题。但是,它使用函数来打印消息。无论如何都有用户输入并仍然一次打印一个字符?如果我失去了你,看看这个例子:

def slowPrint(s):
for c in s:
    sys.stdout.write(c)
    sys.stdout.flush()
    time.sleep(0.025)

这是slowPrint代码。但我想接受用户的输入,如:

variable = input('I want this bit printed one character at a time')

有没有办法呢?


考虑到您在Stack Exchange上看到了一个问题,最好也可以在Stack Exchange上提出您的问题。
PeterH
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.