Printing mixtures in integers and strings

Neil Benn neil.benn at cambridgeantibody.com
Wed Mar 28 14:26:58 EST 2001


Hello,

            I'm trying to use something like this:-

def move(row): #Moves the dispenser to the row on the plate
    print "Moved to Row - " + row

    Where row is expected to be a number.  However when I import this into
teh interpreter I get an error message - stating that __add__ and __radd__
have not been defined:-

Traceback (innermost last):
  File "<console>", line 1, in ?
  File "c:\projects\scripting\TrialScripting\AcmeBRD.py", li
TypeError: __add__ nor __radd__ defined for these operands

    However when I enter text e.g. "BOB" into the function it works fine!
Therefore I assume that I need to explicity convert the into to a string,
does anybody know how to do that - I can;t find the command in teh docs!!!

    Thanks, in advance, for your help.

Cheers,

Neil Benn
Automation Informatics Scientist
Cambridge Antibody Technology





More information about the Python-list mailing list