printable characters
Fredrik Lundh
fredrik at pythonware.com
Fri Dec 3 08:32:05 EST 1999
Ralf Hildebrandt <hildeb at www.stahl.bau.tu-bs.de> wrote:
> How can I find out if a character is printable?
> There seems to be no equivalent to isprint() of C.
that's probably because "isprint" is completely brain-
dead: after all, whether a character is "printable" or
not depends on the output device...
> Right now I use:
>
> def isprint(char):
> return (ord(char) in range(32, 127))
def isprint(char, lo=chr(32), hi=chr(126)):
return lo <= char <= hi
</F>
More information about the Python-list
mailing list