【发布时间】:2021-07-19 16:57:19
【问题描述】:
我一直在用 python 3.9 编写一个程序,并且在拥有这段代码之后:
#Print 3 dots at the interval shown
def dots(t):
t *= 3
sleep(t)
print('.', end='')
sleep(t)
print('.', end='')
sleep(t)
print('.')
这叫它:
# These are completely aesthetic
sleep(0.25)
print("Defining Functions", end='')
dots(0.4)
我希望程序打印 Defining Functions 并在 1.2 秒后 3 次,在末尾添加一个点 (.)。真正发生的是在 3.85 秒后,它用点打印了整个内容(Defining Functions...)。所以在添加新行(第三个点)之前它没有打印任何东西。
对不起,如果乱七八糟,我不知道如何做好这些问题
【问题讨论】:
标签: python python-3.x newline