What is the Python equivalent of Perl\'s chomp function, which removes the last character of a string if it is a newline?
chomp
"line 1\nline 2\r\n...".replace('\n', '').replace('\r', '') >>> 'line 1line 2...'
or you could always get geekier with regexps :)
have fun!