python __repr__和__str__ 的区别

The str() function is meant to return representations of values which are fairly human-readable, while repr() is meant to generate representations which can be read by the interpreter (or will force a SyntaxError if there is not equivalent syntax).
So it would be true: obj==eval(repr(obj))

你可能感兴趣的:(python学习笔记)