[Tutor] Whitespace

Andrei Kulakov ak@silmarill.org
Tue, 13 Nov 2001 21:13:20 -0500


On Tue, Nov 13, 2001 at 07:02:45PM -0700, 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?

Whitespace is blanks, newlines, tabs. You're probably talking about
string.whitespace which is simply a string of all whitespace characters.

>>> string.whitespace
'\t\n\x0b\x0c\r '
>>> print string.whitespace




>>>

You use it like this:

if somechar in string.whitespace:
    print "somechar is whitespace!"

> 
> Thank,
> M
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org