whitespace and ?asc()?

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Tue Jul 1 19:11:48 EDT 2003


Ray Tomes wrote:

> 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?

12 is not NP, but FF (Form Feed). Probably NP means New Page ??
(which is the same, actually...)

> 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()?

ord!  See the Library Reference, on builtin functions:
http://www.python.org/doc/current/lib/built-in-funcs.html#l2h-47

import string.
for c in string.whitespace:
	print ord(c)

--Irmen





More information about the Python-list mailing list