📜  python 打印对象 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:19.513000             🧑  作者: Mango

代码示例3
>>> class Test:
...     def __repr__(self):
...         return "Test()"
...     def __str__(self):
...         return "member of Test"
... 
>>> t = Test()
>>> t
Test()
>>> print(t)
member of Test