class object:
""" The most base type """
def __str__(self, *args, **kwargs): # real signature unknown
""" Return str(self). """
pass

class object:
    """ The most base type """
def __str__(self, *args, **kwargs): # real signature unknown
    """ Return str(self). """                   意思是:在python3.x版本,所有类默认继承object类,因此继承 object 的类 __str__()方法,该方法,用内置函数str(self),处理对象
    pass

 

class str(object):
    """
    str(object='') -> str
    str(bytes_or_buffer[, encoding[, errors]]) -> str
    
    Create a new string object from the given object. If encoding or
    errors is specified, then the object must expose a data buffer
    that will be decoded using the given encoding and error handler.
    Otherwise, returns the result of object.__str__() (if defined)
    or repr(object).
    encoding defaults to sys.getdefaultencoding().
    errors defaults to 'strict'.
    """
## 上面的说得很清楚,str(obj),如果对象有__str__方法,返回这个方法执行的结果,__str__,如果没有定义,则执行repr(obj)

 

 

class str(object):
"""
str(object='') -> str
str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or
errors is specified, then the object must expose a data buffer
that will be decoded using the given encoding and error handler.
Otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to sys.getdefaultencoding().
errors defaults to 'strict'.
"""
posted on 2018-08-31 18:09  yellwonfin  阅读(117)  评论(0)    收藏  举报