I am confused about ' and "

John Gordon gordon at panix.com
Thu Jul 10 19:16:18 CEST 2014


In <cfa25009-b200-4fcc-beb7-83634546cd20 at googlegroups.com> fl <rxjwg98 at gmail.com> writes:

> Please tell me because I have looked it around for one hour about it.

There is no difference between ' and " when used to enclose strings, with
one exception: a double-quoted string can contain single-quotes without the
need to escape them with a backslash, and vice-versa.

For example:

    string2 = "It's a beautiful day in the neighboorhood."
    string1 = 'He said to me, "Hello Thomas."'

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon at panix.com    watch 'House', or a real serial killer to watch 'Dexter'.




More information about the Python-list mailing list