[Tutor] New to Python and programming and need suggestion
Sun, 7 Jan 2001 03:47:27 -0800 (PST)
> The stuff about '%' is the stuff on string interpolation. With '%', you
> can build up your SQL statements pretty easily:
> fname = 'Curtis'
> lname = 'horn'
> stmt = """insert into names (first_name, last_name)
> values ('%s', '%s')" % (fname, lname)
> is one example.
... err... that is, if I had done it properly. Oops. The last line
should have been:
stmt = """insert into names (first_name, last_name)
values ('%s', '%s')""" % (fname, lname)
instead. I had forgotten to close off the triple quotes.