[Tutor] Tutor digest, Vol 1 #846 - 3 msgs

Sharriff Aina NHYTRO@compuserve.com
Fri, 1 Jun 2001 18:09:50 -0400



Actually I had tried "stripping" even on both sides, before database acce=
ss
and after, no difference. This worked:

##
result =3D string.replace(myform,'\n', '')

it was a NEWLINE that tripped me up the whole time :-))


Thanks for the tip all the same

Best regards


Sharriff



Nachricht geschrieben von INTERNET:tutor@python.org
>>###
>>>> myform =3D '''this is a test form
> =

> with some carriage\r\n returns in it.'''
>>>> myform =3D myform.replace('\r', '')
>###
> =


or simply use strip(), which will remove leading and trailing whitespace =
of
any
kind.  Which, in this instance seems like the right thing to do.  There i=
s
also
rstrip() which only strips from the right.<