python

超轻量级php框架startmvc

python3实现逐字输出的方法

更新时间:2020-06-22 02:48 作者:startmvc
如下所示:importsys,timedefprint_one_by_one(text):   sys.stdout.write("\r"+""*60+"\r")#/r光标回

如下所示:


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")

以上这篇python3实现逐字输出的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。