Last active
May 6, 2020 08:54
-
-
Save geekgogo/63515b6e5197cc113c4c9fc22d93cfc0 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
# 切分列表l,使每个子列表的长度为12 | |
l = [i for i in range(50)] | |
result = [l[i:i+12] for i in range(0,len(l), 12)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment