[Tutor] Strip?

Alan Gauld alan.gauld at btinternet.com
Wed Apr 30 19:32:02 CEST 2008


"Wolfram Kraus" <wolfram.kraus at fen-net.de> wrote


>> What characters are included as whitespace characters? Spaces? 
>> Tabs?
>> Newlines? For some reason, I was reading whitespace as just spaces.

> "whitespace
>     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."

>>> import string
>>> for c in string.whitespace:
...   print repr(c)
...
'\t'
'\n'
'\x0b'
'\x0c'
'\r'
' '
>>>

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld














More information about the Tutor mailing list