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ù)可以是浮點(diǎn)型以指定精確的時(shí)間,但是程序真正暫停的時(shí)間可能長(zhǎng)于請(qǐng)求的時(shí)間也可能短于暫停的時(shí)間。
2. raw_input( )
通過(guò)等待輸入來(lái)讓程序暫停
3. os.system("pause")
通過(guò)執(zhí)行操作系統(tǒng)的命令來(lái)讓程序暫停,該函數(shù)是通過(guò)實(shí)現(xiàn)標(biāo)準(zhǔn)C函數(shù)system( )來(lái)實(shí)現(xiàn)的。
Python2.4新加入了subprocess模塊,而且官方建議使用改模塊替換os.system所以,也可以這樣寫(xiě):
subprocess.call("pause",shell=True)
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
