Proper way to split Python list into list of lists on matching list item delimeter
<pre><code>list = ['a', 'b', 'c', '', 'd', 'e', 'f', '', 'g','h','i']

def chunk(list, delim):
    ct = list.count(delim)
    chunks = [[]] * (ct+1)
    for iter in range(ct):
        idx = list.index(delim)
        chunks[iter] = list[:idx]
        list = list[idx+1:]
    chunks[ct] = list
    return chunks

print chunk(list, '')
</code></pre>

<p>Produces:</p>

<pre><code>[['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']]
</code></pre>

<p>Which is what I want, but I feel like this is the 'c' way to accomplish this. Is there a more pythonistic construct I should know? </p>

<pre><code>lists = ['a','b','c','','d','e','f','','g','h','i']
new_list = [[]]
delim = ''
for i in range(len(lists)):
    if lists[i] == delim:
        new_list.append([])
    else:
        new_list[-1].append(lists[i])

new_list
[['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']]
</code></pre>

python