whitespace and ?asc()?

Ray Tomes rtomes at ihug.co.nz
Tue Jul 1 18:17:17 EDT 2003


Hi all

I am totally new to python. On the whole I really like the design of the 
language and after just one day may be considered a convert.

I was trying to find out the exact definition of whitespace so I went to 
look at strings.whitespace to find out which chars were whitespace, and 
found 9, 10, 11, 12, 13, 32 which according to my ancient ascii chart are 
TAB, LF, VT, NP, CR, SPACE. Anyone know what NP = 12 is?

Also, in trying to find the ASCII (or is it ANSI) values for characters I 
could not find the reverse function for chr() [in BASIC it is asc()]- can 
someone please tell me what reverses chr()?

I had to do this yucky thing to decode whitespace ...

import string
x=string.whitespace
for b in x:
     for i in range(256):
         if chr(i) == b:
             print i

Ray Tomes





More information about the Python-list mailing list