我有字典,如:切片列表排序块
item_count_per_section = {1: 3, 2: 5, 3: 2, 4: 2}
而从这个字典中检索到的项目的总数:
total_items = range(sum(item_count_per_section.values()))
现在我想通过以下方式字典的值转换total_items
:
items_no_per_section = {1: [0,1,2], 2: [3,4,5,6,7], 3:[8,9], 4:[10,11] }
iee切片total_items
按顺序排列以从先前的“迭代”索引开始并从最初的字典结束于value
。