Computer >> Computer tutorials >  >> Programming >> Python

How do we use double quotation in Python?


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
'hello'
>>> var2="hello"
>>> var2
'hello'

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"