str() vs repr() functions in python 2.7.5 [duplicate]
问题 This question already has an answer here: Difference between __str__ and __repr__? 22 answers what is the difference between str() and repr() functions in python 2.7.5? Explanation on python.org: 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 no equivalent syntax) But it wasn't clear for me. some examples: >>> s =