[Tutor] Line Continuation Confusion

Alan Gauld alan.gauld@blueyonder.co.uk
Sat Jul 26 16:51:01 2003


> oCursor.execute("SELECT count(*) 
> FROM SchoolPlans  
> WHERE SchoolsId = 1;")

Single quoted strings have to be on one line, if you had used 
a triple quoted string it would be fine.

Some further examples:

def f(s): pass
def g(s,i): pass

f(""" SELECT FOO FROM BAR
      WHERE X = 42""")

g("SELECT COUNT FROM FOO", 42)

g( "SELECT COUNT FROM FOO",
   42)

f("SELECT FOO FROM BAZ \
   WHERE X=42")   # can use  the explicit separator '\' too

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld