Skip to content

Instantly share code, notes, and snippets.

@recuraki
Created November 8, 2016 00:00
Show Gist options
  • Save recuraki/f5da2e9ffd38526109cc9f94fdee4298 to your computer and use it in GitHub Desktop.
Save recuraki/f5da2e9ffd38526109cc9f94fdee4298 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
l = [100,200,201,202,203,301,303,305,306,401,402,403,405,501,502,601,602,603,701]
# [[100, 200, 201, 202, 203, 301, 303, 305], [401, 402, 403, 405, 501, 502, 601, 602], [701]]
def f(s, l = 9):
i = 0
for i in range(len(s) / l):
yield s[l * i:l * i + 8]
yield s[l * (i + 1): len(s)]
print([x for x in f(l)])
@recuraki
Copy link
Author

recuraki commented Nov 8, 2016

s=[]のとき[[]]になっちゃうのは微妙か。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment