Wednesday, June 22, 2022

Python - Escape characters

# The following line of code will never work
# Because of the quotes around the word "never"
#txt = "This will "never" work"

# The fix is to escape the quotes
txt = "This will \"never\" work"

print(txt)

"""

\'    = Single quote
\\    = Backslash
\n    = New line
\r    = Carriage return
\t    = Tab
\b    = Backspace
\f    = Form feed

"""