Pyhton curses.ascii - Control Character Constants














































Pyhton curses.ascii - Control Character Constants




Control Characters Constants

curses.ascii provides constants for working with Control Character. Control Characters are basically non-printable which are used to perform specific action when displaying any text and does not represent any written symbol. for e.g. - "BS" for backspace, "TAB" for tab and "SP" for space etc. These control characters are not of much significance now-a-days and derives their origin from old teleprinter conventions before the use of digital computers. 

curses.ascii has a total of 36 control character constants which are as follows:

Constant

Explanation

ASCII Value

NUL

0

SOH

Start of heading, console interrupt

1

STX

Start of text

2

ETX

End of text

3

EOT

End of transmission

4

ENQ

Enquiry, goes with ACK flow control

5

ACK

Acknowledgement

6

BEL

Bell

7

BS

Backspace

8

TAB

Tab

9

HT

Alias for TAB: [Horizontal tab]

9

LF

Line feed

10

NL

Alias for LF: [New line]

10

VT

Vertical tab

11

FF

Form feed

12

CR

Carriage return

13

SO

Shift-out, begin alternate character set

14

SI

Shift-in, resume default character set

15

DLE

Data-link escape

16

DC1

XON, for flow control

17

DC2

Device control 2, block-mode flow control

18

DC3

XOFF, for flow control

19

DC4

Device control 4

20

NAK

Negative acknowledgement

21

SYN

Synchronous idle

22

ETB

End transmission block

23

CAN

Cancel

24

EM

End of medium

25

SUB

Substitute

26

ESC

Escape

27

FS

File separator

28

GS

Group separator

29

RS

Record separator, block-mode terminator

30

US

Unit separator

31

SP

Space

32

DEL

Delete

127


curses.ascii also provides a variable named "controlnames" which is a list of all the control character constants. It can be used to print a list of all the control character constants.



NOTE - controlnames only prints the name of 33 control character ignoring duplicates such as "TAB" and "NL", and "DEL".

We can check the ASCII value of Control Characters Constants by simply printing them:


  <-PREV                                                                                                                                               NEXT->

Comments