python - while 循环使用 python 列表

标签 python list

my_list=[1,2,3,4,5]

i = 10
while i < 10:
   print i ,my_list
   i = i +1

我想要的输出:

1,1
2,2
3,3
4,4
5,5
6,1
7,2
8,3
9,4
10,5

我怎样才能实现这个目标?

最佳答案

my_list=[1,2,3,4,5]
for index, item in enumerate(my_list*2, start = 1):
    print index,item

关于python - while 循环使用 python 列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40748546/

相关文章:

python - 按公共(public)日期对数组数据进行排序

python - numpy rearray 的花哨索引在分配后丢失了引用

python - 当元组列表中相同项目的值是字符串时,对它们的值求和

python - Python 中无法散列的查找表

python - Plotly:如何使用 go.Bar 为组指定颜色?

python - PyTorch 中的再现性和性能

python - 如何以编程方式将登录凭据传递到站点

python - Python 中的字典分组和聚合列表

c# - 为什么在创建新对象时 C# 链表中的值会发生变化?

Python——获取排序列表中元素索引的有效方法,按多个属性排序