[Tutor] perl's chomp equivalent?
Mon, 17 Jul 2000 23:26:05 +0200
On Mon, Jul 17, 2000 at 05:17:41PM -0400, Tim Condit wrote:
> Is there anything similar to perl's chomp, which removes newline
> characters from the end of a line? I'm using this, which works just fine
> if not..
Something similar. string.strip() removes trailing and leading whitespace
from a string, rstrip() only trailing whitespace. So spaces and stuff too.
> if merge_file[i][-1] == "\n":
> print merge_file[i][:-1]
> print merge_file[i]
But this works as well, of course.
Remco Gerlich, firstname.lastname@example.org