Printing mixtures in integers and strings

Emile van Sebille emile at fenx.com
Thu Mar 29 15:06:24 EST 2001


Use ',' instead of '+'
--or--
print "Moved to Row - %d" % row

--

Emile van Sebille
emile at fenx.com

---------
"Neil Benn" <neil.benn at cambridgeantibody.com> wrote in message
news:3ac38cf6$0$12246$ed9e5944 at reading.news.pipex.net...
> 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