Problem stripping line feeds

Byron DesertLinux at netscape.net
Sun Jul 25 02:11:43 CEST 2004


Hi Robert,

I don't know if this will help too much, but have you tried the following:

	import string
	cleanedText = string.strip("String with carriage return goes here.")

Byron
---


Robert Oschler wrote:
> Hello,
> 
> I am using the following function to try and strip both carraige returns and
> line feeds, ASCII 13 and 10 respectively, from a string.  It doesn't seem to
> be working:
> 
> x = filter(lambda c: c not in "\012\015", string.strip(x)) # octal version
> 
> I also tried:
> 
> x = filter(lambda c: c not in "\r\n", string.strip(x)) # escape char.
> version
> 
> What am I doing wrong?
> 
> Thanks



More information about the Python-list mailing list