(line)
return line.split('#')[0]
Remove everything following comment # characters in line.

    >>> from sympy.physics.quantum.qasm import trim
    >>> trim('nothing happens here')
    'nothing happens here'
    >>> trim('something #happens here')
    'something '
Remove everything following comment # characters in line.
Remove everything following comment # characters in line .
def trim(line):
    """Remove everything following comment # characters in line.

    >>> from sympy.physics.quantum.qasm import trim
    >>> trim('nothing happens here')
    'nothing happens here'
    >>> trim('something #happens here')
    'something '
    """
    if not '#' in line:
        return line
    return line.split('#')[0]
def trim ( line ) : if not '#' in line : return line return line . split ( '#' ) [ 0 ]