io.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Thu, 05 May 2011 09:24:41 -0700
changeset 13 a4e763e563c5
parent 7 cbb51ef4dd6d
child 15 30a851aa0675
permissions -rw-r--r--
Draw spheres using glutWiredSphere

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