New in version 1.6.
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:
|SOH||Start of heading, console interrupt|
|STX||Start of text|
|ETX||End of text|
|EOT||End of transmission|
|ENQ||Enquiry, goes with ACK flow control|
|HT||Alias for TAB: ``Horizontal tab''|
|NL||Alias for LF: ``New line''|
|SO||Shift-out, begin alternate character set|
|SI||Shift-in, resume default character set|
|DC1||XON, for flow control|
|DC2||Device control 2, block-mode flow control|
|DC3||XOFF, for flow control|
|DC4||Device control 4|
|ETB||End transmission block|
|EM||End of medium|
|RS||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 digital computers.
The module supplies the following functions, patterned on those in the standard C library:
These functions accept either integers or strings; when the argument is a string, it is first converted using the built-in function ord().
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.
The following function takes either a single-character string or integer value; it returns a string.
'^?'. If the character has its meta bit (0x80) set, the meta bit is stripped, the preceding rules applied, and "!" prepended to the result.