在python中使用sleep函数设置延时函数,具体方法如下:
sleep:sleep()函数的作用是用于推迟调用线程的运行,可通过参数secs指秒数,表示进程挂起的时间。
sleep()函数语法:
time.sleep(t)
参数:
t:推迟执行的秒数。
sleep()函数使用方法:
import time
print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:python如何设置函数索引