Difference between double and single quotes

Erik Max Francis max at alcyone.com
Tue Aug 1 14:38:10 EDT 2000


pauljolly at my-deja.com wrote:

> Please can someone tell me whether Python distinguishes between double
> and single quotes in any way? This was brought to my attention by a
> friend who queried my use of double and single quotes, saying that in
> the UNIX shell a distinction is made.

They're both interchangeable.  They're used to help with quoting of the
quotes themselves, viz.:

    '"Buk," said the duck.'
    "There's a duck here."

Specifically, in Python the quotes are not used to determine whether
variables are embedded in strings, as they are in shell scripting or
Perl or some other languages; Python does not embed variables that way.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ A man can stand a lot as long as he can stand himself.
\__/ Axel Munthe
    Fat Boy and Little Man / http://www.fatboyandlittleman.com/
 Watch Fat Boy and Little Man go about their antics.



More information about the Python-list mailing list