0
How can I use the double quatation symbol in a string
5 Answers
+ 4
In Python use a backslash \". or put the double quotes in a single quote
print('"name"')
print("\"name\"")
0
In Python, the escaping method is \. One can escape "" or '' using this.
For eg. print("this is a \"human\"")
0
Another alternative in python is to use triple quotes (either single or double, but obviously same type at start and end):
print("""no needs to escape " (double quote) nor ' (single quote)""")
print('''no needs to escape " (double quote) nor ' (single quote)''')
0
Varun Vaswani triple quotes literal string are meant for do multiline strings and comments, and a literal string is totaly valid as argument of any function, even the print() function ^^
- 1
visph , one can't use "' for print and other strings since in the syntax, it's meant for do strings or multiline comments...