python3实现逐字输出的方法
时间:2022-09-04 10:41:57|栏目:Python代码|点击: 次
如下所示:
import sys,time
def print_one_by_one(text):
sys.stdout.write("\r " + " " * 60 + "\r") # /r 光标回到行首
sys.stdout.flush() #把缓冲区全部输出
for c in text:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(0.1)
print_one_by_one("hello word")






