如何理解Python'帮助'文档

时间:2016-09-20 19:53:46

标签: python

例如

>>> help(str)


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'.
 |  
 |  Methods defined here:
 |  
 |  __add__(self, value, /)
 |      Return self+value.
 |  
 |  __contains__(self, key, /)
 |      Return key in self.
 |  
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  capitalize(...)
 |      S.capitalize() -> str

我想func(args[, a[, b]]) 表示参数ab是可选的

令我困惑的是功能的身份

func(...)是什么意思? func(arg, arg, /) /的含义如何?

0 个答案:

没有答案