0
What is the use of "\n, \t, \r" in python
5 Answers
+ 5
These all are the escape sequences in python. Have a look
http://www.python-ds.com/python-3-escape-sequences
+ 4
Python strings, the backslash "\" is a special character, also called the "escape" character. It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a carriage return. Conversely, prefixing a special character with "\" turns it into an ordinary character.
First read basics pls dont ask here such types of question you can find answers in solo tutorials . Only question posting is not solution you can search on Google also do some hardwork .
+ 2
\n for next line
\t for tab
\r use backspace and any slash in your code
0
\n represents a newline character and is used for line breaks or starting a new line.
\t represents a tab character and is used for horizontal indentation or spacing.
\r represents a carriage return character and is used to move the cursor to the beginning of the current line without advancing to the next line.
These escape sequences are used to control the formatting and structure of strings and text output in Python, if you want to see how they are used go here: https://coderhax.com/snippets/python/python-escape-sequence-list
- 1
"\n"=newline
"\t" = space
"\r" backspace