Skip to content

Instantly share code, notes, and snippets.

@samehmohamed88
Created November 21, 2015 23:56
Show Gist options
  • Save samehmohamed88/28703c78ca3a6d619b60 to your computer and use it in GitHub Desktop.
Save samehmohamed88/28703c78ca3a6d619b60 to your computer and use it in GitHub Desktop.
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