Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def slice_sequence(sequence, limit):
- """
- Return subsets of sequence, each no larger than limit.
- """
- end = 0
- maxsize = len(sequence)
- while True:
- start = end
- end = limit + end
- end = end if end < maxsize else maxsize
- yield sequence[start: end]
- if end == maxsize:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement