您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

python中sleep函数用法实例分析

2025/5/4 0:35:49发布24次查看
本文实例讲述了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 sleepprint( 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程序设计有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product