What are some ways in Python to produce the equivalent of the Perl chomp function? The chomp function in Perl removes the "newline" byte(s). I know about rstrip and strip. I want to maintain any existing non-newline whitespace that exists at the end of the string.