What is Escape Sequence in Python?

When we print String with the single quotation and double quotation inside can cause SyntaxError because String has been fulfilled with quotation mark single and double and because of that it cannot be printed with one of those.

Untitled

Because of that to print String just like that it used Triple Quotes or Escape Sequence to print String

Escape Sequence

Escape sequence is started with the reverse slash and can be interpreted differently.

If the single quotation mark is utilized to represent string, then all of single quotation mark that exist in the string must be passed and the same thing is used for single quotation mark.

# Initial String
Stringl = '''I'm "Smart"'''
print("Initial String with use of Triple Quotes: ")
print(Stringl)

# Escaping Single Quote
Stringl = 'I\\'m "Smart"'
print("\\nEscaping Double Quotes: ")
print(String1)

#Printing Paths with the 
# use of Escape Sequences
Stringl = "C:\\\\Python\\\\MySkill\\\\"
print("\\nEscaping Backslashes: ")
print(Stringl)

#Printing paths with the
# the use of Tab
Stringl = "Hi\\tSmartGuy"
print("\\nTab: ")
print(Stringl)

# Printing Paths with the
# use of New Line
Stringl = "Python\\nMySkill"
print("\\nNew Line: ")
print(Stringl)
Initial String with use of Triple Quotes: 
I'm "Smart"

Escaping Single Quotes: 
I'm "Smart"

Escaping Backslashes: 
C:\\Python\\MySkill\\

Tab: 
Hi	SmartGuy

New Line: 
Python
MySkill

Untitled