print(a) 调用的是a的__str__方法 在python解释器里直接敲a后回车,调用的是a.__repr__() 如果没有定义__str__ __str__=__repr__() 转载于:https://www.cnblogs.com/95CC/p/8391175.html