[Patty] | I tried the following piece of code and got : | | "TypeError: not enough arguments for format string" | | tag = """ | <select name='percent'> | <option selected VALUE=%s>%s</option> | | <option VALUE='-'>-</option> | <option VALUE='0'>0%</option> | <option VALUE='10'>10%</option> | <option VALUE='20'>20%</option>
[... snip similar lines ...] | </select>""" % (selected_value,selected_value) When Python sees % inside a string which is then qualified by a % operator, it expects *every one* of the % signs to introduce a substitution qualifier, like %s or %d. If you actually want a % sign in the string -- and you do here -- you need to put *two* % signs. So this will work: discount_achieved = 15 print "I got %d%% discount" % discount_achieved while this won't: discount_achieved = 15 print "I got %d% discount" % discount_achieved So, replace all the 10%, 20% etc in your string with 10%% and 20%%. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor