Break lines?

Tim Chase python.list at tim.thechases.com
Tue Feb 26 17:45:12 CET 2008


> Ok thanks! Btw why double quotes " instead of single ' ?

Either one will do...there's not much difference.  I try to use 
double-quotes most of the time, just so when I include an 
apostrophe in-line (which I do more often than I include a 
double-quote in-line), I don't have to think.

   string1a = "John's dog"
   string1b = 'John\'s dog'
   string2a = "She said \"hello\""
   string2b = 'She said "hello"'
   string3a = 'She said "John\'s nice" in a letter'
   string3b = "She said \"John's nice\" in a letter'
   string3c = """She said "John's nice" in a letter"""
   string3d = '''She said "John's nice" in a letter'''

My usual aim is for clarity, so I tend to go with the versions 
that have the fewest backslashes in them.

-tkc







More information about the Python-list mailing list