How do you create a string with a double quote? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How do you create a string with a double quote?

10th Dec 2015, 10:34 PM
Jeffrey
14 Answers
+ 16
\" is used to create string containing double quote
24th Dec 2015, 1:59 AM
Devjit acharya
+ 11
print("The program printed, \"Hello, World!\".")
10th Mar 2016, 4:44 PM
Jason C. Rochon
Jason C. Rochon - avatar
+ 4
\'' is for double quote and for single quote is \'..
20th Feb 2016, 7:19 AM
Tushar Sirohi
Tushar Sirohi - avatar
+ 4
Just include it in the string, but make sure the string is single quote delimited. Example: print('Hello "World"')
24th Mar 2016, 10:57 AM
lmnnreg
+ 4
In python, I prefer to use single quote ' for string, so whenever I want add double quote ", just add it normaly, it looks simpler. we also can do it vice versa. however, you also need to know to use the traditional \ for special character.
23rd Jun 2016, 4:01 AM
Farhan Ramli
Farhan Ramli - avatar
+ 3
print "He said:\"This is how\"."
17th Feb 2016, 9:38 AM
Patrick White
Patrick White - avatar
+ 2
you can print the double quote surrounded by single quotes or the other option is to use the scape character \. Example: with single quote: '"hello"' with scape character: \"hello\"
1st Dec 2016, 8:37 PM
Francisco Javier Coenda
Francisco Javier Coenda - avatar
+ 1
Have a read about escape characters. just type backslash \ right before the " you want add to the string
30th Oct 2016, 4:01 PM
Hasan Al-Yazidi
Hasan Al-Yazidi - avatar
+ 1
use \" for use \n for new line and \a for a beeb (usefull to nitify errors within program )
25th Dec 2016, 8:57 PM
Mulweli Luvhengo
Mulweli Luvhengo - avatar
0
escape sequences are used they are combination of characters following \ to print " \"is used
24th Nov 2016, 11:33 AM
Raghav Prakash Agarwal
Raghav Prakash Agarwal - avatar
0
there is a prob. by typing a \' to create a string with a double quote
26th Nov 2016, 10:17 AM
pratish singh
0
what is the difference between double and single qoute
1st Dec 2016, 4:31 AM
AbuAli
AbuAli - avatar
0
use \s for it it will print what ever is written within brackets.
7th Dec 2016, 8:23 PM
Inshal Saleem
Inshal Saleem - avatar
- 5
use three quotes """ hi hello world """"
7th Jul 2016, 6:20 PM
Bhaskara Rao Malla
Bhaskara Rao Malla - avatar