how do i map this?
Ben Finney
bignose+hates-spam at benfinney.id.au
Sun Nov 12 23:11:31 EST 2006
"ronrsr" <ronrsr at gmail.com> writes:
> #row is a dictionary with keys: zid, keywords, citation, quotation
> def print_row(row):
> print """<tr>
> <td class="pad">%(keywords)s
> </td>
> <td class="pad">%(quotation)s
> </td>
> <td class="pad">%(citation)s
> </td>
> <td class="pad" align="center"><form action="update.py"
> name="updateform" enctype="application/x-www-form-urlencoded"
> method="GET"><input type="hidden" name="zid" value="%(zid)d"><input
> type="submit" value="Edit"></form>
> </td>
> </tr>
> """
You're printing a string, and never using that 'row' parameter.
Perhaps this will help illustrate:
>>> print "spam %(foo)s eggs"
spam %(foo)s eggs
>>> print "spam %(foo)s eggs" % {'foo': "Wortle"}
spam Wortle eggs
The 'print' statement doesn't care about the format specifiers; it
just wants a string expression. It's the formatting operator, '%',
that looks for them.
<URL:http://docs.python.org/lib/typesseq-strings.html>
--
\ "When I was little, my grandfather used to make me stand in a |
`\ closet for five minutes without moving. He said it was elevator |
_o__) practice." -- Steven Wright |
Ben Finney
More information about the Python-list
mailing list