【发布时间】:2013-12-16 15:04:56
【问题描述】:
我想制作这样的程序,它从字符串中读取字符并在延迟后打印每个字符,使其看起来像打字效果。
现在我的问题是睡眠功能无法正常工作。它在长时间延迟后打印整个句子。
import sys
from time import sleep
words = "This is just a test :P"
for char in words:
sleep(0.5)
sys.stdout.write(char)
我使用“sys.stdout.write”来删除字符之间的空格。
【问题讨论】:
标签: python python-2.7 sleep