Generals question about 'string' and "string"


#1

Hey everybody, while practicing python, it attracted my attention, that it is possible to use either ' ...' or " ..." to define a string element, is there a real difference ?


#2

No, not really. Personally, I prefer to use "", but plenty of others use ''. It is purely a matter of personal preference.


#3

no, there isn't.

The only thing is when you want to use an apostrophe in your string you better use quotation marks:

"that's better"

otherwise you need to escape the ':

'that\'s not better'

same for if you want to use quotation mark in string, use apostrophe to mark beginning and end of string


#4

Thank you very much :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.