Python time sleep()方法

Python 教程 · 2019-02-03 12:26:38

描述

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

语法

sleep()方法语法:

time.sleep(t)

参数

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

返回值

该函数没有返回值。

实例

以下实例展示了 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

点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html

查看所有标签

Dive Into Python

Dive Into Python

Mark Pilgrim / Apress / 2004-11-5 / GBP 31.49

Python is a new and innovative scripting language. It is set to replace Perl as the programming language of choice for shell scripters, and for serious application developers who want a feature-rich, ......一起来看看 《Dive Into Python》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

SHA 加密
SHA 加密

SHA 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器