Python time sleep()方法

版权声明:本文为博主原创文章,引用时请附上链接。 https://blog.csdn.net/abc13526222160/article/details/85139204

1、描述

Python time sleep() 函数推迟调用线程的运行,可通过参数secs指秒数,表示进程挂起的时间。

2、语法

sleep()方法语法:

time.sleep(t)

3、参数

  • t -- 推迟执行的秒数。

4、返回值

该函数没有返回值。

5、实例

以下实例展示了 sleep() 函数的使用方法:

#!/usr/bin/python
import time
print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()

以上实例输出结果为:

Start : Tue Feb 17 10:19:18 2013
End : Tue Feb 17 10:19:23 2013

猜你喜欢

转载自blog.csdn.net/abc13526222160/article/details/85139204