Created
September 10, 2022 03:14
-
-
Save lotusirous/cfcee6645c02f8f9c0154f4262d5c173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_by_n(seq, n): | |
"""Split a sequence by n elements""" | |
while seq: | |
yield seq[:n] | |
seq = seq[n:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment