日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python常見循環(huán)結(jié)構(gòu)有哪些

1、for…in…

該格式在python中是最為常見的一種格式,使用極為廣泛。

格式:for 參數(shù) in 循環(huán)體:
pass

在上面的格式中,有很多內(nèi)容可以作為循環(huán)體,比如元組、列表、字符串等等。只要能穿越循環(huán),就可以作為循環(huán)體存在。

其中參數(shù)主要用來存儲(chǔ)每個(gè)循環(huán)體發(fā)送的單個(gè)元素,從而實(shí)現(xiàn)循環(huán)功能。在實(shí)踐中,它經(jīng)常與if判斷語句結(jié)合使用。

#input
str_01 = '時(shí)間都去哪了?。?!'
for i in str_01:
print(i)
 
#output
時(shí)
間
都
去
哪
了
!
!
!

2、while

while循環(huán)和for…in…循環(huán)的不同之處在于,while要先將循環(huán)變量初始化或者直接使用while True 這種死循環(huán)形式。

格式:i = 0
 while i >=10:
  pass
  i +=1
#input
while True:
print('hello world!!!__hello python!!!')
#output
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
hello world!!!__hello python!!!
.
.
.
.
.
.

 以上就是python中2種常見循環(huán)結(jié)構(gòu),希望能對(duì)大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)python教程


新聞標(biāo)題:創(chuàng)新互聯(lián)Python教程:python常見循環(huán)結(jié)構(gòu)有哪些
標(biāo)題URL:http://m.5511xx.com/article/cdeogde.html