# 通过enumerate函数处理列表之后再遍历可以同时获得元素索引和值
for index, elem in enumerate(list1):
    print(index, elem)

相关文章:

  • 2021-05-30
  • 2022-12-23
  • 2021-10-15
  • 2021-12-19
  • 2022-12-23
  • 2021-11-17
  • 2021-05-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案