get rid of all the trailing newlines in string python code example Example: python strip newline from string a_string = a_string.rstrip("\n")