Little problem with the "+" operator

Siggy Brentrup bsb at winnegan.de
Mon Mar 5 10:14:37 EST 2001


Zamurai <zamurai at gmx.net> writes:

> I want to make the following:
> 
> variableOne = 500
> myVariable = variableOne + "cool"
> 
> But I get the following error: "unsupported operand types for +"
> 
> Does someone know how to solve the problem?

That depends on what your problem is :-)

You're trying to add a string to an integer, which isn't supported.
If you expect '500cool' as a result, try

myVariable = str(variableOne) + 'cool'


Siggy





More information about the Python-list mailing list