remove trailing newline in string 'test string \n\n','test string \n\n'.rstrip('\n')