Por ejemplo ...
$python
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1000
>>> b = "www.misnotaslinux.blogspot.com"
>>> c = a + b
Traceback (most recent call last):
File "
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Hacerlo pasando las variables int a str antes de concatenar:
>>> a = 1000
>>> b = "www.misnotaslinux.blogspot.com"
>>> c = str(a) + b
>>> print c
1000www.misnotaslinux.blogspot.com
>>>
No hay comentarios:
Publicar un comentario