I'm new and confused | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm new and confused

I keep checking but I can't tell how to show double quotes in a string.

12th Aug 2019, 5:47 PM
L H
L H - avatar
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: """ """ """ ''' ''' '''
12th Aug 2019, 6:00 PM
Seb TheS
Seb TheS - avatar
+ 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.
12th Aug 2019, 5:56 PM
storm
storm - avatar
+ 1
Thanks for the info! I really appreciate it!
12th Aug 2019, 5:58 PM
L H
L H - avatar
+ 1
And if you want to display \ you have to specify \\.
12th Aug 2019, 11:45 PM
Sonic
Sonic - avatar