The below table contains a list of Python Escape sequence characters and relevant examples. You can run all below examples from python prompt.
Example:
$ python
Python 2.7.5 (default, Jun 24 2015, 00:41:19) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print u"\u041b"
Л
Escape SequenceDescriptionExampleOutput
\\ Prints Backslash print "\\" \
\` Prints single-quote print "\'" '
\" Pirnts double quote print "\"" "
\a ASCII bell makes ringing the bell alert sounds ( eg. xterm ) print "\a" N/A
\b ASCII backspace ( BS ) removes previous character print "ab" + "\b" + "c" ac
\f ASCII formfeed ( FF ) print "hello\fworld" hello
         world
\n ASCII linefeed ( LF ) print "hello\nworld" hello
world
\N{name} Prints a character from the Unicode database print u"\N{DAGGER}"
\r ASCII carriage return (CR). Moves all characters after ( CR ) the the beginning of the line while overriding same number of characters moved. print "123456\rXX_XX" XX_XX6
\t ASCII horizontal tab (TAB). Prints TAB print "\t* hello"     * hello
\t ASCII vertical tab (VT). N/A N/A
\uxxxx Prints 16-bit hex value Unicode character print u"\u041b" Л
\Uxxxxxxxx Prints 32-bit hex value Unicode character print u"\U000001a9" Ʃ
\ooo Prints character based on its octal value print "\043" #
\xhh Prints character based on its hex value print "\x23" #
LinuxConfig.org


ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: