Created
November 21, 2015 23:56
-
-
Save samehmohamed88/28703c78ca3a6d619b60 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 chunk(lst, size): | |
return [lst[i:i+size] for i in range(0, len(lst), size)] | |
#instances = my list of instancse | |
count = len(instances) | |
size = len(instances)/len(subnets) | |
num = len(instances)/size | |
_list = chunk(range(count), size) | |
for i in range(num): | |
print _list[i]: | |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | |
[12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] | |
[24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment