cut off \n
Alan Kennedy
alanmk at hotmail.com
Mon Jun 9 12:08:12 EDT 2003
Tom,
Try this
>>>s = "This is a line with a newline at the end\n"
>>>s.strip()
"This is a line with a newline at the end"
>>>t = "This is a line without a newline at the end"
>>>t.strip()
"This is a line without a newline at the end"
More info about .strip() and the related functions .lstrip() and .rstrip() can
be found here
http://www.python.org/doc/current/lib/module-string.html
As well as the ".strip" function in the string module, each string instance
supports the .strip() method as well, as can be seen above.
regards,
--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
More information about the Python-list
mailing list