[Tutor] Whitespace

Sean 'Shaleh' Perry shalehperry@home.com
Tue, 13 Nov 2001 18:12:25 -0800 (PST)


On 14-Nov-2001 Mike Yuen wrote:
> I'm not understanding how "whitespace" works for strings. 
> 
> I thought we could use it like split, lower, etc.
> 
> Can someone provide an example of how this works?
> 

If you open string.py from your python dist you will see:

whitespace = ' \t\n\r\v\f'

as you can see, it is a string.  Common usage is:

if char in whitespace:
    handle_whitespace(char)

where char is something like 'char = " "' or 'char = "c"'.