🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Python Notes
Topic #22

Escape Characters


Escape Character

To insert characters that are illegal in a string, use an escape character.

An escape character is a backslash \ followed by the character you want to insert.

An example of an illegal character is a double quote inside a string that is surrounded by double quotes:

Example

txt = "We are the so-called "Vikings" from the north."

To fix this problem, use the escape character \":

Example

txt = "We are the so-called \"Vikings\" from the north."

Escape Characters

Other escape characters used in Python:

Code Result Try it
' Single Quote
\ Backslash
\n New Line
\r Carriage Return
\t Tab
\b Backspace
\f Form Feed
\ooo Octal value
\xhh Hex value

Want to go beyond the notes?

Join CodingNow 2.0's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Escape Characters – FAQs

Quick answers about learning Escape Characters in Python.

This free note from CodingNow 2.0 explains Escape Characters in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on CodingNow 2.0, including Escape Characters, is 100% free with no signup required.
With focused practice, most students grasp Escape Characters in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now