[Tutor] Strip?

Wolfram Kraus wolfram.kraus at fen-net.de
Wed Apr 30 16:40:51 CEST 2008

Am 30.04.2008 16:18, Hansen, Mike schrieb:
> strip(  	s[, chars])
>     Return a copy of the string with leading and trailing characters
> removed. If chars is omitted or None, whitespace characters are removed.
> If given and not None, chars must be a string; the characters in the
> string will be stripped from the both ends of the string this method is
> called on. Changed in version 2.2.3: The chars parameter was added. The
> chars parameter cannot be passed in earlier 2.2 versions. 
> What characters are included as whitespace characters? Spaces? Tabs?
> Newlines? For some reason, I was reading whitespace as just spaces.
> Mike

See http://docs.python.org/lib/node39.html

     A string containing all characters that are considered whitespace. 
On most systems this includes the characters space, tab, linefeed, 
return, formfeed, and vertical tab. Do not change its definition -- the 
effect on the routines strip() and split() is undefined."


More information about the Tutor mailing list