On Sun, 23 Oct 2005, Chris Hallman wrote:
> I made a mistake in my first email..... I meant that I can't get fc to write
> to the file. Here is the error:
>
> Traceback (most recent call last):
> File "thread_test_ping.py", line 37, in ?
> output.write(fc + " failures found.\n")
> TypeError: unsupported operand type(s) for +: 'int' and 'str'
Hi Chris,
Python's string concatenation operation requires the left hand side and
the right hand side to be strings. The problem above says that:
fc
isn't a string --- it's a number --- so it can't be directly concatenated
to the string:
" failures found.\n".
The documentation in:
http://www.python.org/doc/lib/typesseq-strings.html
should help; take a look at that page, and you should be able to figure
out how to format that number into the string. Alternatively, you can
also use the str() function to turn things into strings to avoid the type
error.
If you're still getting stuck, send another email to the list, and we'll
be happy to elaborate.
Best of wishes!
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor