The curses.ascii module supplies name constants for
ASCII characters and functions to test membership in various
ASCII character classes. The constants supplied are names for
control characters as follows:
Start of heading, console interrupt
Start of text
End of text
End of transmission
Enquiry, goes with ACK flow control
Alias for TAB: ``Horizontal tab''
Alias for LF: ``New line''
Shift-out, begin alternate character set
Shift-in, resume default character set
XON, for flow control
Device control 2, block-mode flow control
XOFF, for flow control
Device control 4
End transmission block
End of medium
Record separator, block-mode terminator
Note that many of these have little practical significance in modern
usage. The mnemonics derive from teleprinter conventions that predate
The module supplies the following functions, patterned on those in the
standard C library:
Checks for a non-ASCII character (ordinal values 0x80 and above).
These functions accept either integers or strings; when the argument
is a string, it is first converted using the built-in function
Note that all these functions check ordinal bit values derived from the
first character of the string you pass in; they do not actually know
anything about the host machine's character encoding. For functions
that know about the character encoding (and handle
internationalization properly) see the string module.
The following two functions take either a single-character string or
integer byte value; they return a value of the same type.
Return a string representation of the ASCII character c. If
c is printable, this string is the character itself. If the
character is a control character (0x00-0x1f) the string consists of a
caret ("^") followed by the corresponding uppercase letter.
If the character is an ASCII delete (0x7f) the string is
'^?'. If the character has its meta bit (0x80) set, the meta
bit is stripped, the preceding rules applied, and
"!" prepended to the result.