Not enough arguments for format string

ronrsr ronrsr at gmail.com
Sun Nov 19 21:55:20 EST 2006


is the error message I'm getting here, on the long formatted print
statement. .  I've tried adding arguments, in case I missed one, and it
still gets a syntax error.

here's the info:

#row is a dictionary with keys: zid, keywords, citation, quotation
def print_row(row):
    print row;
    print "row in
print_row","kw=",row["keywords"],"q=",row["quotation"],"c =
",row["citation"],"xyzzy row"


    print """<tr>
      <td class="pad">%s
      </td>
      <td class="pad">%s
      </td>
      <td class="pad">%s
      </td>
      <td class="pad" align="center"><form action="update.cgi"
name="updateform" enctype="application/x-www-form-urlencoded"
method="GET"><input type="hidden" name="zid" value="%d"><input
type="submit" value="Edit"></form>
      </td>
      </tr>
      """%row['keywords'],row['quotation'],row['citation'],row['zid']
    print "done printrow xyzzy"




here's the output, with my debugging info:

{'keywords': 'Agricultural Subsidies, Farmers', 'zid': 319L,
'citation': '\xe2\x80\x9cAgriculture in Crisis,\xe2\x80\x9d
<i>Rethinking US Agricultural Policy: Changing Course to Secure Farmer
Livelihoods Worldwide</i>, September 2003, 9', 'quotation': 'In 2001,
government payments to farmers amounted to an astounding 47 percent of
farmer income, up from about 20 percent in the 1990s. Despite this
enormous infusion of cash, farmer income declined steadily during the
same period, and many US farmers are under increasing financial
stress.'}
row in print_row kw= Agricultural Subsidies, Farmers q= In 2001,
government payments to farmers amounted to an astounding 47 percent of
farmer income, up from about 20 percent in the 1990s. Despite this
enormous infusion of cash, farmer income declined steadily during the
same period, and many US farmers are under increasing financial stress.
c =  "Agriculture in Crisis," <i>Rethinking US Agricultural Policy:
Changing Course to Secure Farmer Livelihoods Worldwide</i>, September
2003, 9 xyzzy row
Traceback (most recent call last):
  File "C:\Documents and Settings\Ronald\My
Documents\spi\zingers\public_html\display.py", line 116, in ?
    zhtml.print_row(adict)
  File "C:\Documents and Settings\Ronald\My
Documents\spi\zingers\public_html\zhtml.py", line 222, in print_row
    print """<tr>
TypeError: not enough arguments for format string


thanks once again, 

-rsr-




More information about the Python-list mailing list