[Python-de] Anfängerfrage...
Fischer, Thomas
ThomasFischer at schmuecker.de
Thu Feb 28 09:53:42 EST 2002
Hallo!
Ich möchte eine Variable (StringText) innerhalb einer Klasse mit sich selbst
addieren
und erhalte dabei die Fehlermeldung:
self.StringText=self.StringText+i
TypeError: unsupported operand types for +
Warum ist das so bzw. wie kann ich das Problem lösen?
class Class:
def __init__(self):
self.StringText=None
def add_string(self):
for i in ('a','b'):
self.StringText=self.StringText+i
c=Class()
c.add_string()
print c.StringText
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://starship.python.net/pipermail/python-de/attachments/20020228/49e2e35c/attachment.htm
More information about the Python-de
mailing list