the result is : TypeError: __str__ returned non-string (type NoneType), but i think my __str__ function is correct,any idea? thanks, this is under python 3.5.1
class srvinfo(object):
def __init__(self,id,name=None,comp=None):
self.id=id
self.name=name
self.comp=comp
def change_usr(self,id,name,comp):
self.id=id
self.name=name
self.comp=comp
def __str__(self):
return f '{self.id} {self.name} : {self.comp}'
s=srvinfo(1021)
print(s)
s.change_usr(1022,'Jeffery','Microsoft')
print(s)
class srvinfo(object):
def __init__(self,id,name=None,comp=None):
self.id=id
self.name=name
self.comp=comp
def change_usr(self,id,name,comp):
self.id=id
self.name=name
self.comp=comp
def __str__(self):
return f '{self.id} {self.name} : {self.comp}'
s=srvinfo(1021)
print(s)
s.change_usr(1022,'Jeffery','Microsoft')
print(s)