Escape sequence | Python Language | Tutorial

Learn | Practice|

Python Language

 

Escape sequence :

An escape sequence is a sequence for the characters.  

The properties are that they represent itself when used inside a character or string literal,instead they convert into another character or a sequence of characters. It is very hard or unable to represent directly.

Some examples :

Escape       Sequences |     Meaning
 \' - single quote
 \" - double quote
 \\ - backslash
 \n - new line
 \t - tab
 \b - backspace

 

Single Quote :

print('Hello \'Happy\' World')

>>
Hello 'Happy' World

 

Double Quote :

print("Hello \"Happy\" World")

>>
Hello "Happy" World


Backslash :

print("Hello World\\")

>>
Hello World\

 

New Line :

print("Hello\nWorld")

>>
Hello
World

 

Tab :

Create a space

print("Hello\tWorld")

>>
Hello 'Happy' World

 

Backspace :

 

print("Helloo\b World")

>>
Hello World

 

---------------------------------------------------

Related Links :

Download: Python

Install : python

---------------------------------------------------

 

Comments

Post a Comment

Give your feedback!
DO NOT SPAM !!
NO THIRD PARTY PROMOTIONAL LINK !!!! (else comment will be deleted.)

Popular posts from this blog

Print name in a pattern | name as abbreviation | C-Program

Print Fibonacci Series using Recursion | C program :