Escape sequence in python
Escape sequences starts with a backslash and it can be interpreted differently. When you have use single quote to represent a string, all the single quotes inside the string must be escaped. Similar is the case with double quotes.
# String within triple quotes to display a string with single quote
>>> print ('''They said, "What's there?"''')
They said, "What's there?"
# String within single quotes to display a string with single quote using escape sequence
>>> print ('They said, "What\'s there?"')
They said, "What's there?"
# String within double quotes to display a string with single quote using escape sequence
>>> print ("They said, \"What's there?\"")
He said, "What's there?"
VIDEO LINK:
12 STD || Part-2 COMPUTER || Chap 8 - Strings and String Manipulation
WATCH HERE:
YOUTUBE LINK:
Tweet |
No comments:
Post a Comment
உங்கள் கருத்துகளை சொல்லுங்கள்