Top 10 Programming Languages to Learn in 2019

ProgrammingPythonPython Basic Tutorial

Python Escape Sequence List and Uses



Escape sequences are the sequence of characters that is translated into other characters or a sequence of characters that are difficult to represent directly.

All the escape sequences contain more than one character. They all start with a backslash ‘\’ also called Escape Character.  Escape sequences are generally used in String. You can check out our latest tutorial on Python Strings to know more about it.


Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> print('Hello\nWorld')
>>> print('Hello\tWorld')
Hello	World
>>> print('I\'m backslash - \\')
I'm backslash - \
>>> print('\066')

List of Escapes Sequences

Escape SequenceCharacter representedExampleOutput
\bBackspaceprint(‘pyc’ + ‘\b‘ + ‘thon’)python
\\Back Slashprint(‘\\‘)\
\’Single Quoteprint(‘\’‘)
\”Double Quoteprint(‘\”‘)
\nPage Line Feed (New Line)print(“Hello\nWorld”)Hello
\tHorizontal tabprint(“Hello\tWorld”)Hello    World
\uhhhhPrints 16-bit hex value Unicode characterprint(“\u0041”)A
\UhhhhhhhhPrints 32-bit hex value Unicode characterprint(“\U00000041”)A
\oooPrints character based on its octal numberprint(“\066”)6
\xhhPrints character based on its hex valueprint(“\x23”)#
Related posts

Amazon Price Scraper and Auto Mailer Python App


Top 10 Deep Learning frameworks in 2019 (with comparison)


Python vs R - Data Visualization


Cython vs Python - Speed up your Python

Leave a Reply

Your email address will not be published. Required fields are marked *

Improve Your Python

...with a fresh 🐍 Python Trick 💌
code snippet every couple of days:
You can also contribute to PyBlog
Visit Contribute to Community

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

PyBlog will use the information you provide on this form to be in touch with you and to provide updates and marketing.