def read_lines(filename):
    """
    Read lines from file, stripping comments and newlines.

    """
    with open(filename, 'rt') as f:
        lines = [ line if '#' not in line else line[:line.index('#')] for line in f.readlines() ]
    return lines