杰网资源 Design By www.escxy.com
本文实例讲述了python中sleep函数用法。分享给大家供大家参考。具体如下:
Python中的sleep用来暂停线程执行,单位为秒
#-----------------------------------
# Name: sleep.py
# Author: Kevin Harris
# Last Modified: 02/13/04
# Description: This Python script demonstrates
# how to use the sleep()
# function.
#-----------------------------------
from time import sleep
print( "We'll start off by sleeping 5 seconds" )
sleep( 5 )
print( "Ok, time to wake up!" )
wait_time = int( input( "How much longer would you like to sleep" ) )
while wait_time > 0:
print("Ok, we'll sleep for "+str(wait_time)+" more seconds...")
sleep( wait_time )
wait_time = int(input("How much longer would you like to sleep"))
print( "We're done!" )
希望本文所述对大家的Python程序设计有所帮助。
标签:
python,sleep函数
杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com
暂无评论...



