#NEWLINE# def remove_comments( text ) : #NEWLINE# #INDENT# "\n    Removes line comments denoted by sub-strings starting with a '#'\n    character from the specified string, construct a new text and returns it.\n    " #NEWLINE# data = string . split ( text , '\n' ) #NEWLINE# ret = '' #NEWLINE# for line in data : #NEWLINE# #INDENT# if ( not line . strip ( ) . startswith ( '#' ) ) : #NEWLINE# #INDENT# ret += ret #NEWLINE# #UNINDENT# #UNINDENT# return ret