新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:怎么停止python腳本

銅鼓ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!
1、time.sleep(secs)
參考文檔原文:
Suspend execution for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal's catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system.
大意:
讓程序執(zhí)行暫停指定的秒數(shù),參數(shù)可以是浮點型以指定精確的時間,但是程序真正暫停的時間可能長于請求的時間也可能短于暫停的時間。
2、raw_input( )
通過等待輸入來讓程序暫停。
3、os.system("pause")
通過執(zhí)行操作系統(tǒng)的命令來讓程序暫停,該函數(shù)是通過實現(xiàn)標(biāo)準(zhǔn)C函數(shù)system( )來實現(xiàn)的。
python2.4新加入了subprocess模塊,而且官方建議使用改模塊替換os.system所以,也可以這樣寫:
subprocess.call("pause",shell=True)
眾多python培訓(xùn)視頻,盡在python學(xué)習(xí)網(wǎng),歡迎在線學(xué)習(xí)!
網(wǎng)頁標(biāo)題:創(chuàng)新互聯(lián)Python教程:怎么停止python腳本
本文URL:http://www.5511xx.com/article/dhhjggj.html


咨詢
建站咨詢
