Tsallaka zuwa abun ciki
Justice Tech School

Escape Characters

A backslash starts an escape. \n is a new line, \t is a tab, \\ is a backslash, \" is a double quote. A raw string r"..." keeps backslashes as they are, which is handy for Windows paths and regular expressions. Triple quotes allow several lines.

Example
print("Line one\nLine two")
print("Name:\tAda")
print("She said \"hi\"")
print(r"C:\new\folder")
print("""First
Second""")

Result

Line one
Line two
Name:	Ada
She said "hi"
C:\new\folder
First
Second

Exercise

Which escape makes a new line?

print("ab")

Quiz Test

What does a raw string r"..." do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.