Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 1 — Escape Sequences

Lesson 6 of 50 in the free Python Programming notes on Siksha Sarovar, written by Rohit Jangra.

Escape Sequences

An escape sequence starts with a backslash (\) and represents a special character that cannot be typed directly into a string.

Escape SequenceMeaning
\nNewline
\tHorizontal tab
\\Literal backslash
\'Single quote
\"Double quote
\rCarriage return
\bBackspace
\fForm feed
\0Null character
\vVertical tab
\oooCharacter with octal value ooo
\xhhCharacter with hex value hh
print("Hello\nWorld")        # newline
print("Name:\tAge")          # tab
print("She said \"Hi\"")     # embedded double quotes
print('It\'s Python')        # embedded single quote
print("C:\\Users\\Python")   # literal backslash (Windows path)
print("\x48\x49")             # HI (hex escapes)

Output:

Hello
World
Name:	Age
She said "Hi"
It's Python
C:\Users\Python
HI

Raw Strings

Prefix a string with r to disable escape-sequence processing — useful for regular expressions and Windows file paths.

path = r"C:\Users\Python\new_folder"
print(path)   # C:\Users\Python\new_folder (backslashes kept as-is)