Python | Printing String with double quotes
Many times, while working with Python strings, we have a problem in which we need to use double quotes in a string and then wish to print it. This kind of problem occurs in many domains like day-day programming and web-development domain. Lets discuss certain ways in which this task can be performed.
Method #1 : Using backslash (“\”)
This is one way to solve this problem. In this, we just employ a backslash before a double quote and it is escaped.
The string escaped with backslash : geeks"for"geeks
Method #2 : Using triple quotes
This is one more way in python to print and initialize a string. Apart from multiline comment, triple quotes are also good way of escaping.
The string escaped with triple quotes : geeks"for"geeks
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course