class Student(object): def __init__(self,name): self.name=name def __str__(self): return 'Student object(name:%s)' % self.name#给用户看的 __repr__=__str__#给开发者调试看的 print(Student('huan'))
打印结果 Student object(name:huan) 空格
>
Sign in to make a reply
董DHH董
打印结果 Student object(name:huan) 空格