newbie: concatenate literals (using jython)

razornl at gmail.com razornl at gmail.com
Fri Dec 23 04:41:47 EST 2005


Note that
"getListenPort()" returns an int.  Is that a problem?

yes, that's a problem. Python needs strings for concatenation
apparently. you can use the .toString() methon on the int to convert it
to a string ;)

a=1
s='hello'
print s+a

TypeError: __add__ nor __radd__ defined for these operands


print s+a.toString()
hello1




More information about the Python-list mailing list