io.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Tue, 21 Jun 2011 16:21:45 -0700
changeset 16 69f6b439b161
parent 15 30a851aa0675
permissions -rw-r--r--
Added saving of edges and spheres in povray

def line_blocks(filename, size = 1):
    block = []
    with open(filename) as f:
        for line in f:
            if not line.strip() or line.startswith('#'): continue
            block.append(line)
            if len(block) == size:
                yield block
                block = []