Problem stripping line feeds
DesertLinux at netscape.net
Sun Jul 25 02:11:43 CEST 2004
I don't know if this will help too much, but have you tried the following:
cleanedText = string.strip("String with carriage return goes here.")
Robert Oschler wrote:
> 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.
> What am I doing wrong?
More information about the Python-list