Escape characters are a set of characters that help you include special characters in strings.
# this will raise a syntax error message = 'Hy, how are you 'doing'' # to include '' quote around doing message = 'Hy, how are you \'doing\'' print(message) # outputs: "Hy, how are you 'doing' "
string1 = "Hello\tWorld!" # prints Hello with four spaces to the right before World print(string1) # outputs: Hello World! respond = "I'm good \nHow about you" print(respond)
These are few examples of escape characters in Python.