Little problem with the "+" operator
Alex Martelli
aleaxit at yahoo.com
Mon Mar 5 10:06:57 EST 2001
"Zamurai" <zamurai at gmx.net> wrote in message
news:983802310.155838463 at news.t-online.de...
> I want to make the following:
> variableOne = 500
> myVariable = variableOne + "cool"
>
> But I get the following error: "unsupported operand types for +"
Right -- you can't add an integer and a string.
> Does someone know how to solve the problem?
Sure -- make both variables into strings, e.g.
myVariable = str(variableOne) + "cool"
Alex
More information about the Python-list
mailing list