0

What is the use of "\n, \t, \r" in python

30th Aug 2020, 4:27 AM
Balam RaviKumar
Balam RaviKumar - avatar
5 Answers
+ 5
These all are the escape sequences in python. Have a look http://www.python-ds.com/python-3-escape-sequences
30th Aug 2020, 4:47 AM
Ayush Kumar
Ayush Kumar - avatar
+ 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 .
30th Aug 2020, 4:31 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
\n for next line \t for tab \r use backspace and any slash in your code
30th Aug 2020, 4:30 AM
Akash Agrawal
Akash Agrawal - avatar
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
5th Jul 2023, 4:30 AM
Jarvis Silva
Jarvis Silva - avatar
- 1
"\n"=newline "\t" = space "\r" backspace
30th Aug 2020, 6:04 PM
XYNCSTEP
XYNCSTEP - avatar