[Tutor] Whitespace

alan.gauld@bt.com alan.gauld@bt.com
Wed, 14 Nov 2001 17:19:33 -0000


> I'm not understanding how "whitespace" works for strings. 

I assume you mean the string.whitespace predefined sequence?
Its used for testing whether something is a whitespace 
charater or not:

while str[i] not in string.whitespace: i += 1

will find the first whitespace char in str.


> I thought we could use it like split, lower, etc.

Nope, its a variable not a function.
Rather like string.numbers, string.punctuation, 
uppercase, lowercase etc.

> Can someone provide an example of how this works?

See above.

Alan G