What is Escape Sequence in Python | EP-23 Escape Sequence in Python | Escape Characters in Python

preview_player
Показать описание
Escape Sequences in Python
"""
While printing Strings with single and double quotes in it causes SyntaxError because
String already contains Single and Double Quotes and hence cannot be printed with the
use of either of these. Hence, to print such a String either Triple Quotes are used or
Escape sequences are used to print Strings.
Escape sequences start with a backslash and can be interpreted differently.
If single quotes are used to represent a string, then all the single quotes present in
the string must be escaped and the same is done for Double Quotes."""

company = """i'm "cybrosys" """
print("Initial string with the use of triple quotes:")
print(company)

Escaping Single Quote
company = 'I\'m "cybrosys"'
print("Escaping Single Quotes:")
print(company)

Escaping Double Quotes
company = "I'm a \"cybrosys\""
print("Escaping Double Quotes:")
print(company)

Printing Paths with the
use of Escape Sequences
company = "C:\\Python\\cybrosys\\"
print("\nEscaping Backslashes: ")
print(company)

#PythonProgramming #EscapeSequences #LearnPython #PythonTutorial #CodingTips #ProgrammingBasics #PythonForBeginners #PythonCode #TechEducation #CodingTutorials #python #programming #tutorial #escapesequence #pythonprogramming #pythontips #codingtutorial #learntocode #python3 #pythondeveloper

Connect With Us:
—————————————
Рекомендации по теме
join shbcf.ru