def reduce_multiline ( string ) : string = str ( string ) return " " . join ( [ item . strip ( ) for item in string . split ( "\n" ) if item . strip ( ) ] )
python remove newline with strip method of strings and list comprehensions
reduces a multiline string to a single line of text .
def reduce_multiline(string):
    """
    reduces a multiline string to a single line of text.


    args:
        string: the text to reduce
    """
    string = str(string)
    return " ".join([item.strip()
                     for item in string.split("\n")
                     if item.strip()])