这篇文章给大家分享的是有关查看python文档的方法有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考。一起跟随小编过来看看吧。
调用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
感谢各位的阅读!关于查看python文档的方法有哪些就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到吧!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。