हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा १२

Write short notes on Escape sequences with examples. - Computer Science

Advertisements
Advertisements

प्रश्न

Write short notes on Escape sequences with examples.

संक्षेप में उत्तर

उत्तर

Escape Sequences:
In 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 new line, and “\r” is a carriage return. For example to print the message “It’s raining”, the Python command is >>> print (“It\’s raining”)
It’s raining
Python supports the following escape sequence characters. 

Escape sequence character Description Example Output
\\ Backslash >>> print("\\test") \test
\' Single-quote >>> print("Doesn\'t") Doesn't
\" Double-quote >>> print("\"Python\"") "Python"
\n New line print("Python","\n","Lang.") Python Lang..
\t Tab print("Python","\t","Lang..") Python Lang..
shaalaa.com
Tokens
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 5: Python - Variables and Operators - Evaluation [पृष्ठ ६६]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
अध्याय 5 Python - Variables and Operators
Evaluation | Q 4. | पृष्ठ ६६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×