def strip_line ( line , sep = os . linesep ) : try : return line . strip ( sep ) except TypeError : return line . decode ( 'utf-8' ) . strip ( sep )
remove line separators from text python
Removes occurrence of character ( sep ) from a line of text
def strip_line(line, sep=os.linesep):
    """
    Removes occurrence of character (sep) from a line of text
    """

    try:
        return line.strip(sep)
    except TypeError:
        return line.decode('utf-8').strip(sep)