B
b83503104
Hi,
Can someone tell me the difference between single quote and double
quote?
Thanks
Can someone tell me the difference between single quote and double
quote?
Thanks
There is none. Except that in a double quoted string, single quotes don'tHi,
Can someone tell me the difference between single quote and double
quote?
5Hi,
Can someone tell me the difference between single quote and double
quote?
Hi,
Can someone tell me the difference between single quote and double
quote?
Thanks
John said:
The only difference is when you want to include " or ' inside the string. If
you want to include the "like" quote, then escape it ("\"", '\''). If you
include the "unlike" quote, no escape is needed ("'" or '"').
I think that people new to programming will use '' if it is unshifted on their
keyboards. People from a "C" background may use "" for strings (since in that
language, '' is for a single character only).
Michael said:Very zen.
Steven said:But unfortunately incorrect, since the original poster
didn't ask for the difference between the ordinal
values of the single quote and double quote characters,
but for the difference between the characters themselves.
But unfortunately incorrect, since the original poster
didn't ask for the difference between the ordinal
values of the single quote and double quote characters
[...]But unfortunately incorrect, since the original poster
didn't ask for the difference between the ordinal
values of the single quote and double quote characters,
Can someone tell me the difference between single quote and double
quote?
Steven said:But unfortunately incorrect, since the original poster didn't ask for
the difference between the ordinal values of the single quote and double
quote characters, but for the difference between the characters themselves.
"spaghetti pescatora")Steven said:It may shock some people to learn that difference in the sense of
mathematical subtraction is not the only meaning of the word, but there
it is. One wouldn't, I hope, misunderstand "What is the difference
between spaghetti marinara and spaghetti pescatora?" and attempt to
subtract one from the other, since subtraction is not defined for
foodstuffs.
Can someone tell me the difference between single quote and double
quote?
One habit that seems to crop up, though, is that I will use '' for
internal strings and "" for strings that will eventually get seen by
the user. Don't ask me why.
Peter said:"spaghetti pescatora")
-119
Works for me... ;-)
[Robert Kern]One habit that seems to crop up, though, is that I will use '' for
internal strings and "" for strings that will eventually get seen by
the user. Don't ask me why.
One sure thing is that it would help, later, if you ever want to
internationalise a Python program. Not that it occurs that often!
[Robert Kern]
One sure thing is that it would help, later, if you ever want toOne habit that seems to crop up, though, is that I will use '' for
internal strings and "" for strings that will eventually get seen
by the user. Don't ask me why.
internationalise a Python program. Not that it occurs that often!
Whoa. Why? Does xgettext not recognize _('')?
François Pinard said:There is no strong reason to use one and avoid the other. Yet, while
representing strings, Python itself has a _preference_ for single
quotes.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.