新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:Python里有死循環(huán)嗎
何為死循環(huán)?在編程中,一個無法靠自身的控制終止的循環(huán)被稱為死循環(huán)。

滑縣網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)建站于2013年成立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
python中的死循環(huán)
這里True,代表1是真,0是假
i = 0 while True: i = i + 1 if i == 50: print 'I have got to the round 50th!' continue if i>70:break print i
死循環(huán)
i = 0 while True: i = i + 1 if i == 5000000: print 'I have got to the round 50th!' break # if i>70:break # print i
兩種方法打印10000000
方法一
i = 0 while i< 10000000: i = i + 1 continue print 'I have got to the round',i # break # if i>70:break # print
方法二:
程序走完才走else,不然不走else
i = 0 while i< 10000000: i = i + 1 # continue else: print 'I have got to the round',i # break # if i>70:break # print i
while和for循環(huán)對比(一個道理)
i = 0 while i< 10000000: i = i + 1 # continue else: print 'I have got to the round',i # break # if i>70:break # print i for i in range(100): print i else: print 'The loop is done!'
python學(xué)習(xí)網(wǎng),大量的免費python學(xué)習(xí)視頻,歡迎在線學(xué)習(xí)!
本文標(biāo)題:創(chuàng)新互聯(lián)Python教程:Python里有死循環(huán)嗎
URL地址:http://www.dlmjj.cn/article/cdppedg.html


咨詢
建站咨詢
