what is the use of escape sequence (\)in python programming language?
Answers
Answered by
0
Answer:
Usually, the escape sequence is used to type/print characters that usually mean something else.
Example:
The following code will not execute, because there are 3 quotation marks:
print('I'm going to do something!')
The "I" has become its own string. "m going to do something!" isn't part of a string, resulting in an error. However, if you print using the escape sequence, it will work.
print('I\'m going to do something!')
Of course, you could always use "", but other situations will require the escape sequence.
Hope it helped!
Similar questions
Math,
6 months ago
Computer Science,
6 months ago
Hindi,
6 months ago
Physics,
11 months ago
Math,
11 months ago
Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago