In String literals we can use escape characters to associate a special meaning.
The following are various important escape characters in Python
- \n==>New Line
- \t==>Horizontal Tab
- \r==>Carriage Return
- \b==>Back Space
- \’==>Single Quote
- |v==>Vertical Tab
- \\==>Back Slash Symbol
- \f==>Form Feed
Example:
>>>s=”Webnoid\nschools”
>>>print(s)
Webnoid
school
>>>s=”Webnoid\tschool”
Webnoid school
>>>s=”this is “symbol”
File”<stdin>”, line 1
s=”this is “symbol”
SyntaxError: invalid syntax
>>>s=”This is ” symbol”
>>>print(s)
This is ” symbol