Skip to content

Instantly share code, notes, and snippets.

@geekgogo
Last active May 6, 2020 08:54
Show Gist options
  • Save geekgogo/63515b6e5197cc113c4c9fc22d93cfc0 to your computer and use it in GitHub Desktop.
Save geekgogo/63515b6e5197cc113c4c9fc22d93cfc0 to your computer and use it in GitHub Desktop.
以指定的长度切分列表
# 切分列表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