t = ['B071LF9R6G',B0714BP3H4B0756FL8R7B072HX95ZRB07CX389LXB07D9MZ7BDB07D9L15L5B00L1UNPZ0',B07KDL9RSDB01N02WUM3B072KTNZMWB071Z71BXWB00DU76BOYB07D9NC33MB07G82D89JB076C9X4KSB07CTMG6Y9B071JZ78TDB01NBPP89YB000LJ60F4B07FBJ8CT1B01N77XY1CB06XSCR62YB078H4FK45B01MRVTY7KB07HKH4XMTB0711R3WFHB0725QD6JXB01NCKJsV62222222222B07HJYHH95B0030MIIoUB07HGD4R5NB07PKXNGZHB01HIS1IXEB06XKLFMMVB01DB4TEX0B07B41S34QB07BL2HT3RB07B712499B0716PK6R2B077X9J24CB01N2SBH4JB072854G8HB07KTD2YQ1B07BL3469HB07TJQ5DZNB0711TJZ99]step = 10b = [t[i:i+step] for i in range(0,len(t),step)]for x b: print(x)
遍历结果为10个一组 10个一组的遍历
['B071LF9R6G','B0714BP3H4','B0756FL8R7','B072HX95ZR','B07CX389LX','B07D9MZ7BD','B07D9L15L5','B00L1UNPZ0','B07KDL9RSD','B01N02WUM3']
['B072KTNZMW','B071Z71BXW','B00DU76BOY','B07D9NC33M','B07G82D89J','B076C9X4KS','B07CTMG6Y9','B071JZ78TD','B01NBPP89Y','B000LJ60F4']
['B07FBJ8CT1','B01N77XY1C','B06XSCR62Y','B078H4FK45','B01MRVTY7K','B07HKH4XMT','B0711R3WFH','B0725QD6JX','B01NCKJsV6','2222222222']
['B07HJYHH95','B0030MIIoU','B07HGD4R5N','B07PKXNGZH','B01HIS1IXE','B06XKLFMMV','B01DB4TEX0','B07B41S34Q','B07BL2HT3R','B07B712499']
['B0716PK6R2','B077X9J24C','B01N2SBH4J','B072854G8H','B07KTD2YQ1','B07BL3469H','B07TJQ5DZN','B0711TJZ99']
以上是内存溢出为你收集整理的【python小随笔】将一个列表的值,分成10个一组,遍历的时候每10个遍历一次全部内容,希望文章能够帮你解决【python小随笔】将一个列表的值,分成10个一组,遍历的时候每10个遍历一次所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)