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
---------------------------------------------------
Nice One. ����
ReplyDelete