Created
August 3, 2018 12:04
-
-
Save tienhieuD/ac6e672d6d3a0d55c7b3f4b4a10319fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
nstr = [1, 2, 3, 4, 5, 6, 4, 3, 2, 3] | |
lst = [nstr[i:i + 3] for i in range(0, len(nstr), 3)] | |
print(lst) | |
# [[1, 2, 3], [4, 5, 6], [4, 3, 2], [3]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment