#NEWLINE# def clean_page( page ) : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# script_start = page . find ( '<script' ) #NEWLINE# script_end = page . find ( '</script>' ) #NEWLINE# if ( '<script' in script_start ) : #NEWLINE# #INDENT# script_section = page [ script_start : ( script_end + 9 ) ] #NEWLINE# page = page . replace ( script_section , '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# pure_text = re . sub ( '<.+?>' , '' , page ) #NEWLINE# return pure_text