+ 2
Can anyone explain clear difference between single quotes and double quotes please?
5 Réponses
+ 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.
+ 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.
+ 1
@Kuba thanks Ji... I got clear knowledge...
I am new to this... your replies and guidance really makes me happy... thanks all...
0
oh... thanks Mr. Rodrigo and StarLord
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.