Skip to content
Prev 38913 / 63424 Next

"+" operator on characters revisited

Consider the following from Python 2.6.5:


 >>> 'abc'+ 2

Traceback (most recent call last):
   File "<pyshell#0>", line 1, in <module>
     'abc'+ 2
TypeError: cannot concatenate 'str' and 'int' objects
 >>> 'abc'+'2'
'abc2'
 >>>


       Spencer
On 1/23/2011 8:09 AM, Hadley Wickham wrote: