Object type problem

Jeff Bauer jbauer at rubic.com
Thu May 11 17:43:40 EDT 2000

Jonathan Donald wrote:
> I get an odd (to me) error message when trying to do this:
>         logstr = now + ": " + strng + "\n"
> the error message:
>       TypeError: __add__ nor __radd__ defined for these operands

Try this format:

  logstr = "%s: %s\n" % (now, strng)

Or if you don't want 'None' to appear in logstr:

  if strng:
      logstr = "%s: %s\n" % (now, string)
      logstr = "%s: \n" % now


Jeff Bauer
Rubicon Research

More information about the Python-list mailing list