How do we use double quotation in Python?

PythonServer Side ProgrammingProgramming

Quotation symbols are used to create string object in Python. Python recognizes single, double and triple quoted strings. String literals are written by enclosing a sequence of characters in single quotes ('hello'), or double quotes ("hello")

>>> var1='hello'
>>> var1
>>> var2="hello"
>>> var2

If single quoted text is to be embedded, string should be written in double quotes.

>>> var="Welcome to 'Python Tutorial' from TutorialsPoint"
>>> var
"Welcome to 'Python Tutorial' from TutorialsPoint"

Published on 09-Feb-2018 00:28:44