How to print quotation marks in Python

In this tutorial, we will learn about how to print quotation marks in Python. We will learn both printing single quotes and double quotes string in Python.

Quotation Marks in Python:

Actually, Python doesn’t allow the double quote in a double quote and single quote in a single quote then shows the error. It allows only opposite quotes like double quote in a single quote and single quote in a double quote.

Example: (Doesn’t allow)

String = " "Python" " , it shows that Invalid Syntax.

String = ' 'Python' ', it shows that Invalid Syntax.

Print double quotes in Python

String = ' "Python language is easy to learn" '
print(String)

Output:

"Python language is easy to learn"

Print single quotes in Python

String = " 'Python language is easy to learn' "
print(String)

Output: ‘

Python language is easy to learn'

Also read: Print escape characters in Python
how to escape quotes in Python – escape quotes from string

Leave a Reply

Your email address will not be published. Required fields are marked *