這篇文章給大家分享的是有關(guān)查看python文檔的方法有哪些的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考。一起跟隨小編過來看看吧。
成都創(chuàng)新互聯(lián)公司專注于文縣企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。文縣網(wǎng)站建設(shè)公司,為文縣等地區(qū)提供建站服務(wù)。全流程按需設(shè)計網(wǎng)站,專業(yè)設(shè)計,全程項目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)
調(diào)用help函數(shù),可以看到一個函數(shù)或者方法的字符串文檔。
In [1]: import requests In [2]: help(requests.get) Help on function get in module requests.api: get(url, params=None, **kwargs) Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:` Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response` object :rtype: requests.Response
使用dir可以查看模塊或?qū)ο蠖加心男┓椒ā?/strong>
In [3]: dir(requests) Out[3]: ['ConnectionError', 'HTTPError', 'compat', 'cookies', 'delete', 'exceptions', 'get', 'head', 'hooks', ...
使用ipython+?查看
In [4]: requests.get? Type: function String form:File: /Library/Python/2.7/site-packages/requests/api.py Definition: requests.get(url, params=None, **kwargs) Docstring: Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response
使用pydoc查看字符串文檔
python -m pydoc requests Help on package requests: NAME requests FILE /Library/Python/2.7/site-packages/requests/__init__.py DESCRIPTION requests HTTP library Requests is an HTTP library, written in Python, for human beings. Basic GET usage: >>> import requests >>> r = requests.get('https://www.python.org') >>> r.status_code 200 >>> 'Python is a programming language' in r.content True
感謝各位的閱讀!關(guān)于查看python文檔的方法有哪些就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!