Mailing List Archive

chomp()
is there an equivilent of perl's chomp() in python or
do I have to write the function myself?

cheers, Angus.
chomp() [ In reply to ]
On Mon, 21 Jun 1999 14:08:52 -0700, Angus MacKay <amackay@starvision.com> 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@es.co.nz>