📜  python代码示例中列表中的索引是什么

📅  最后修改于: 2022-03-11 14:46:16.286000             🧑  作者: Mango

代码示例2
butterfly_life_cycle = ["egg", "larva", "pupa", "butterfly"]

print(butterfly_life_cycle.index("egg"))
print(butterfly_life_cycle.index("larva"))
print(butterfly_life_cycle.index("pupa"))
print(butterfly_life_cycle.index("butterfly"))

# output:
# 0
# 1
# 2
# 3