简体   繁体   English

使用信号在 python 中延迟打印文本

[英]Print text with delay in python by using signal

How can I print text with delay of 1 second with using signal.如何使用信号打印延迟 1 秒的文本。 I don't want using sleep().我不想使用睡眠()。

You can use Timer class from threading module.您可以使用threading模块中的Timer class。 It isn't using sleep .它没有使用sleep

from threading import Timer

def examlpe_func():
    print("Nothing here")

t = Timer(1, examlpe_func)
t.start()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM