TypeError: int argument required
rhodri at wildebst.demon.co.uk
Fri Jun 12 14:42:17 EDT 2009
On Fri, 12 Jun 2009 04:56:24 +0100, lucius <lucius.fox08 at 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\"
> 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
More information about the Python-list