+ 2

Can anyone explain clear difference between single quotes and double quotes please?

19th Feb 2017, 2:27 PM
Johnathan Constantine
Johnathan Constantine - avatar
6 Answers
+ 10
I don't think that there's any difference. Basically, if you want to print an apostrophe, use double quotes. print ("You're going now?") If you want to print double quotes, use single quotes. print ('And he said: "I am your father".') Maybe someone else can elaborate further, but I think it's just about code styling.
19th Feb 2017, 2:48 PM
Rodrigo
Rodrigo - avatar
+ 8
Yes, in Python there is no actual difference and you can use them interchangeably (in pairs, that is). The most common use is to be able to include the other one in a string, like Rodrigo suggested, without having to escape the quotation sign.
19th Feb 2017, 8:05 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 1
@Kuba thanks Ji... I got clear knowledge... I am new to this... your replies and guidance really makes me happy... thanks all...
19th Feb 2017, 8:13 PM
Johnathan Constantine
Johnathan Constantine - avatar
0
oh... thanks Mr. Rodrigo and StarLord
19th Feb 2017, 7:49 PM
Johnathan Constantine
Johnathan Constantine - avatar
0
In python both single and double quotes works same.. It's just way that how you define your string.. Either in single quote or in double quote.. And second main thing is that, if you using single quote in your text then you can use double quote to define or vice versa. It help python to not get confuse. That's it.
28th Feb 2017, 10:56 AM
Saharsh Pandey
Saharsh Pandey - avatar