python用range根据数字索引遍历数组的方法

[python] 2024-04-28 圈点667

摘要:python用range根据数字索引遍历数组的方法,直接上例子吧:

python用range根据数字索引遍历数组的方法,直接上例子吧。

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

for i in range(0, len(colours)):

    print i, colour[i]

 

# 0 red

# 1 green

# 2 blue

python  range  数组  

感谢反馈,已提交成功,审核后即会显示