Character Escape Codes

Python supports the standard character escape code

     \               Newline Continuation
     \\              Backslash
     \'              Single quote
     \"              Double quote
     \a              Bell
     \b              Backspace
     \e              Escape
     \n              Line feed
     \v              Vertical tab
     \t              Horizontal tab
     \r              Carriage return
     \0              Null
     \0XX            Octal character value
     \xXX            Hex character value 
  • Note: Escape codes are not interpreted in raw strings
     a = r"\n\r"
     
<<< O'Reilly OSCON 2000, Introduction to Python, Slide 30
July 17, 2000, beazley@cs.uchicago.edu
>>>