Equivalent of Perl chomp?

Paul Watson pwatson at mail.com
Wed Jan 30 04:32:02 EST 2002

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.

More information about the Python-list mailing list