# 一般情况
class TestClass:
def __init__(self):
self.name = 'paomo'
t = TestClass()
print(t)
# <__main__.TestClass object at 0x10f1e5670>
# 改写 __str__ 方法
class TestClass:
def __init__(self):
self.name = 'paomo'
def __str__(self):
return self.name
t = TestClass()
print(t)