On Fri, 12 Jun 2009 04:56:24 +0100, lucius <lucius.fo...@gmail.com> wrote:
I am trying to print some values to a file (using c's printf like method). TypeError: int argument required # this works, i see value on screen print w, h, absX, absY # where result is the return value of my regular expression. w, h, absX, absY = result.group(3), result.group(4), result.group (5), result.group(6) w = 100 h = 200 absX = 10.0 absY = 20.0 # this fails, I get "TypeError: int argument required" print >> fo, "<rect x=\"%f\" y=\"%f\" width=\"%d\" height=\"%d\" style=\"fill:blue;stroke:pink;stroke-width:5;fill-opacity:0.1;stroke- opacity:0.9\"/> " % (absX, absY, w, h) Thank you for any help.
1. This has to be the most incoherent help request that I've seen that included actual information. Figuring out what you were actually doing was quite a challenge. 2. That output string has severe "leaning toothpick" syndrome. Python accepts both single and double quotes to help avoid creating something so unreadable: use them. 3. matchobject.group(n) returns a string, not an int or float. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list