Python time sleep()方法
Python time sleep()方法
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 for 循環語句
- Python 面向對象
- Python XML 解析
- Python3 函數
- Python3 輸入和輸出
- Python3 錯誤和異常
- Python exp() 函數
- Python pow() 函數
- Python os.closerange() 方法
- Python os.dup() 方法
- Python os.getcwd() 方法
- Python os.major() 方法
- Python os.open() 方法
- Python os.tcgetpgrp() 方法
- Python isdigit()方法
- Python maketrans()方法
- Python min()方法
- Python zfill()方法
- Python 字典 Dictionary update()方法
- Python time asctime()方法