位置:首頁 > 軟件操作教程 > 編程開發(fā) > Python > 問題詳情

python應(yīng)用操作——玩轉(zhuǎn)枚舉

提問人:ylm發(fā)布時間:2020-09-29

使用枚舉可以在循環(huán)中方便地找到(當(dāng)前的)索引:

In [54]: testList= [10,20,30]

 

In [55]: for i,value in enumerate(testList):

    ...:     print(i,':',value)

    ...:     0 : 101 : 202 : 30

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部