What is prefered: 'string' or "string"? (Should be in PEP8 ?)

Philipp Lenssen phil at mrinfo.de
Tue Apr 23 07:09:30 EDT 2002


"Petr Prikryl" <Answer.via.news.please.prikrylp at nospam_skil.cz> wrote in
message news:aa3dti$n0$1 at news.nextra.cz...
>..
> In other words, should I prefer writing:
>     s1 = 'first string'
> or
>     s2 = "second string"
>..

For XHTML string output, I prefer single quotes because I don't have to
escape double-quotes within the string, e.g.:
s += '<img src="..." alt="" />'





More information about the Python-list mailing list