Escape sequence in python
Escape sequence used with in the print function.To perform the specified action inside the print function.
Symbol | Uses |
---|---|
\n | Print new line |
\t | Print 4 space |
\' | Print single quotes |
\" | Print double quotes |
\\ | Print Back slash |
\n
print("my\ncrazy\ncoding")
Output
my crazy coding
\t
print("my\tcrazy\tcoding")
Output
my crazy coding
\'
print('my\'crazy\'coding')
Output
my'crazy'coding
\"
print("mycrazy\"coding")
Output
mycrazy"coding
\\
print("mycrazy\\coding")
Output
mycrazy\coding
r' '
print(r'c:\Desktop\new.mycrazycoding')
Output
c:\Desktop\new.mycrazycoding