Skip to content

Instantly share code, notes, and snippets.

@davidchua
Last active May 10, 2016 10:02
Show Gist options
  • Select an option

  • Save davidchua/a97242da1a4d2bd3eba1185f082ba8b5 to your computer and use it in GitHub Desktop.

Select an option

Save davidchua/a97242da1a4d2bd3eba1185f082ba8b5 to your computer and use it in GitHub Desktop.

Revisions

  1. davidchua revised this gist May 10, 2016. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    def chunk(self, l,n):
    def chunk(l,n):
    for i in range(0,len(l),n):
    yield l[i:i+n]
    yield l[i:i+n]

    list = [] # chunks

    chunk(list, 30)
  2. davidchua created this gist May 10, 2016.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    def chunk(self, l,n):
    for i in range(0,len(l),n):
    yield l[i:i+n]