Python for BEGGINERS!

Escape Character

To put it in simple way, some characters have special purpose and use. For example the quotation marks (“ “) that are used in print statement, they are intended to treat any content that is enclosed within the quotes as a string and display it on the screen.

What if you want to display a quotation mark on the screen like “There is no “in between”” which in turn should be enclosed within the two quotes like print(“There is no “in between”” )

Computer raises an error because it’s not understanding why there are extra “ in between. To make computer understand, what we are trying to print, we need to tell the computer to escape or ignore the extra “ written in between.

To avoid this problem, an escape character (‘ \ ‘) is used before the character to be escaped or ignored which has a special purpose.

Ex: print(“There is no \“in between”” )