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