python 遍历

使用python怎么遍历列表并获取列表索引

养鱼的猫咪
467
2021-03-08 13:21:46
栏目: 编程语言
Python开发者服务器,限时0元免费领! 查看>>

使用python怎么遍历列表并获取列表索引

在python中对列表进行遍历并获取列表索引的方法

colours = ["red","green","blue"]

for i, colour in enumerate(colours):

print i, colour

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

相关推荐:Python中怎么遍历列表的索引

0
看了该问题的人还看了