Python Escape Characters Table
The following examples show the working of the different escape characters in a Python context. We provide the output after each
# Single Quote print('\'') # ' # Double Quote print("\"") # " # Newline Character print('Hello\nWorld') # Hello # World # Tabular Character print('Hello\tWorld') # Hello World # Backspace Character print('Backspace: \b') # Backspace: # Carriage Return print('Hello\rWorld') # HelloWorld # Backslash Character print('Backslash: \\') # Backslash: \ # Form Feed print('Hello\ World') # HelloWorld # Octal Value print('\112') # J # Hex Value print('\x44') # D
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.