io.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Thu, 24 Mar 2011 15:15:07 -0700
changeset 11 d2b9ee185b38
parent 7 cbb51ef4dd6d
child 15 30a851aa0675
permissions -rw-r--r--
Pressing P changes the type of camera projection

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 = []