+ 1
I'm new and confused
I keep checking but I can't tell how to show double quotes in a string.
4 Answers
+ 3
These 2 strings are invalid: " " " and ' ' '
You can include a double quote in a string with atleast 3 ways:
Using escape character \:
" \" "
' \' '
This will remove the meaning from " as a closing quote and will treat it just as a single character.
Using quotes that does not match with the closing quotes:
" ' "
' " '
These are both valid strings.
Using docstrings:
""" " """
''' ' '''
Anyways you these would cause errors, because string content would conflict with the closing quotes:
""" """ """
''' ''' '''
+ 1
As double and/or single quotes are used to specify the string itself, a special character may ve need to be placed in front of the double quote to be displayed within a string . this special character may be different for each language.
+ 1
Thanks for the info! I really appreciate it!
+ 1
And if you want to display \ you have to specify \\.