您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關python3查看文檔的方法,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
調用help函數,可以看到一個函數或者方法的字符串文檔。
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 <Response>` object :rtype: requests.Response
使用dir可以查看模塊或對象都有那些方法。
In [3]: dir(requests) Out[3]: ['ConnectionError', 'HTTPError', 'compat', 'cookies', 'delete', 'exceptions', 'get', 'head', 'hooks', ...
使用ipython+?查看
In [4]: requests.get? Type: function String form: <function get at 0x10e6c35f0> 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 <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
關于python3查看文檔的方法就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。