1. 手册中是这样写的:
str(object='')
Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that str(object) does not always attempt to return a string that is acceptable to eval(); its goal is to return a printable string. If no argument is given, returns the empty string, ''.
2. print语句是调用str()函数显示对象,而交互式解释器则调用repr()函数来显示对象。
>>> s1 = "hello world!"
>>> print s1
hello world!
>>> s1
'hello world!'
根据手册中意思,暂时的理解是:str()是给人看的,repr()是给机器看的。