Created
October 24, 2018 04:09
-
-
Save kadaliao/4a808ffadca67f7bbbf60c3d7d251660 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_list(li, chunks=1): | |
for i in range(0, len(li), chunks): | |
yield li[i:i+chunks] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment