【发布时间】:2015-07-08 04:15:59
【问题描述】:
我创建了一个函数来打印每个字符之间有时间延迟的字符串,但是在打印多个字符串时,它们都打印在同一行上。我将如何分隔线? ('\n' 不起作用)
from time import sleep
import sys
def slowly(text):
for letters in text:
print (letters, end=''),
sys.stdout.flush()
sleep(0.1)
if letters == ',':
sleep(1)
slowly("hello world")
slowly("hello world")
结果
"hello worldhello world"...
【问题讨论】:
标签: string python-3.x newline