Ben Caradoc-Davies bmcd at
Mon Jun 21 23:45:59 CEST 1999

On Mon, 21 Jun 1999 14:08:52 -0700, Angus MacKay <amackay at> wrote:
>is there an equivilent of perl's chomp() in python or
>do I have to write the function myself?

string.rstrip(s) strips all trailing whitespace characters from s. If you
really, really, want your trailing whitespace, try

if s[-1]=='\n': s = s[:-1]

Ben Caradoc-Davies <bmcd at>

More information about the Python-list mailing list