A Table of Tables (Escaping Literality)

 It is oft helpful to have a LIST of certain codes like UNICODES, ESCape sequences, etc. (see TOC)

Python Lexical Analysis (here):
TOC:
1: Escape codes
2: Print ESC codes
3: ANSI codes
4: UNICODE


(1) A Table of Escape Sequences (here):

Escape Sequence

Meaning

Notes

\<newline>

Backslash and newline ignored

(1)

\\

Backslash (\)

\'

Single quote (')

\"

Double quote (")

\a

ASCII Bell (BEL)

\b

ASCII Backspace (BS)

\f

ASCII Formfeed (FF)

\n

ASCII Linefeed (LF)

\r

ASCII Carriage Return (CR)

\t

ASCII Horizontal Tab (TAB)

\v

ASCII Vertical Tab (VT)

\ooo

Character with octal value ooo

(2,4)

\xhh

Character with hex value hh

(3,4)

(2) More: G4G re How to print() Escape Characters (here) e.g. via repr() 
    (2.1) Google search for "Table of Python escape sequences" (here)

(3) GitHub -- ANSI escape codes (here)

General ASCII Codes

NamedecimaloctalhexC-escapeCtrl-KeyDescription
BEL70070x07\a^GTerminal bell
BS80100x08\b^HBackspace
HT90110x09\t^IHorizontal TAB
LF100120x0A\n^JLinefeed (newline)
VT110130x0B\v^KVertical TAB
FF120140x0C\f^LFormfeed (also: New page NP)
CR130150x0D\r^MCarriage return
ESC270330x1B\e*^[Escape character
DEL1271770x7F<none><none>Delete character

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

Cursor Controls

ESC Code SequenceDescription
ESC[Hmoves cursor to home position (0, 0)
ESC[{line};{column}H
ESC[{line};{column}f
moves cursor to line #, column #
ESC[#Amoves cursor up # lines
ESC[#Bmoves cursor down # lines
ESC[#Cmoves cursor right # columns
ESC[#Dmoves cursor left # columns
ESC[#Emoves cursor to beginning of next line, # lines down
ESC[#Fmoves cursor to beginning of previous line, # lines up
ESC[#Gmoves cursor to column #
ESC[6nrequest cursor position (reports as ESC[#;#R)
ESC Mmoves cursor one line up, scrolling if needed
ESC 7save cursor position (DEC)
ESC 8restores the cursor to the last saved position (DEC)
ESC[ssave cursor position (SCO)
ESC[urestores the cursor to the last saved position (SCO)

UNICODE (here)

SYMBL (here)


















                      (






































































                      (x) GitHub -- Color codes (here)
                      (y) Python Morsels -- tutorial -- Newlines and escape sequences (here)

                      Comments

                      Popular posts from this blog

                      Links for Python Noobs

                      The Learn HOW to Learn Page

                      Welcome to Circular Import Hell