On Tue, 20 Dec 2005 22:11:01 -0500 in comp.lang.python, Eric McCoy
<[EMAIL PROTECTED]> wrote:

>[EMAIL PROTECTED] wrote:
>> I ported my code from the development to
>> application platform, I found a "type error"
>> on a fileout statement:
>
>> outfile.write(object.id +",")
>
>What is the type of object.id?  I'm guessing an integer.  The exception
>should tell you, e.g.:
>
>  TypeError: unsupported operand type(s) for +: 'int' and 'str'
>
>If I'm right, you can do this:
>
>  outfile.write("%d," % (object.id))

Or, more generally,

   outfile.write("%s, " % object.id)

or even (closer to the original code)

   outfile.write(str(object.id)+", ")

Regards,
                                        -=Dave

-- 
Change is inevitable, progress is not.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to