This Escape Characters lesson is for a beginner. Read the short notes, run each example, then change one name or number and run it again.
A backslash marks a character that is hard to type. \n starts a new line. \" is a quote inside a double-quoted string. \\ is one backslash.
A raw string starts with r. Backslashes in it stay as backslashes, which is what a regular expression usually wants.
Start here
A raw string cannot end with a single backslash.
print("Line one\nLine two") # print writes this; the quotes are not shown
print("She said \"hello\"")
A quote inside text
A backslash lets the quote stay inside the string.
print("She said \"hello\"") # print writes this; the quotes are not shown
A real new line
\n is one character that starts a new line.
print("Line one\nLine two") # print writes this; the quotes are not shown
A tab
\t inserts a tab between the two words.
print("Name\tAsha") # print writes this; the quotes are not shown
