Escape sequence in python

 Sequence of character after backslash ‘\’ are called escape sequence character.

Escape sequence character comprises of more than on character but represent one character when used within the string.

Some of the commonly used escape sequence characters are :-

‘\\’Backslash character
‘\”single quote character
‘\n’Newline character
‘\t’Tab character

Example :-

# for backslash 
print("This is a\\ string")
 
# for single quote in string
print("This is \'a\' string")
 
#for tab 
print("This is a\t string")
 
# for line break
print("This is a\n string")
Python

Output :-

This is a\ string   
This is 'a' string                                                                                                                            
This is a        string                                                                                                                       
This is a                                                                                                                                     
 string 
Markup

These are the most commonly used escape sequence characters. I hope you understand this tutorial. If you have query or suggestion please do a comment.

Thank You.

Comments

Popular posts from this blog

⚠️How to create a virus in termux app ?

List in Python

How To Install Metasploit In Termux App ?