Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. foo = [{}.format(i) for i in range(1, 11)] # not necessarily of this format
  2. bar = [0, 3, 5]
  3.  
  4. [['1', '2', '3'], ['4', '5'], ['6', '7', '8', '9', '10']]
  5.  
  6. result = []
  7. for index, value in enumerate(b):
  8. if index == len(b) - 1:
  9. result.append(a[value:])
  10. elif index == 0 and value != 0:
  11. result.append(a[0: value])
  12. else:
  13. result.append(a[value: b[index + 1]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement