我正在使用anaconda的jupyter ipython笔记本。
有一种快速查看函数参数的方法,就像我们在RStudio
中一样吗?对于例如?merge
在RStudio的右下方窗口显示合并文档。
我特意在寻找matplotlib.figure()
的参数,我在这里找到了这些参数,但这很耗时:http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.figure
发现此帖子与问题相关:Getting list of parameter names inside python function
但不确定是否是同一个问题。
答案 0 :(得分:3)
导入help(matplotlib.figure)
matplotlib
答案 1 :(得分:1)
在命令提示符下键入matplotlib.figure?
,它将为您提供签名和文档:
In [1]: import matplotlib
In [2]: matplotlib.figure?
Type: module
String form: <module 'matplotlib.figure' from '~/venv/lib/python2.7/site-packages/matplotlib/figure.pyc'>
File: ~/venv/lib/python2.7/site-packages/matplotlib/figure.py
Docstring:
The figure module provides the top-level
:class:`~matplotlib.artist.Artist`, the :class:`Figure`, which
contains all the plot elements. The following classes are defined
:class:`SubplotParams`
control the default spacing of the subplots
:class:`Figure`
top level container for all plot elements
探索对象
键入
object_name?
将打印有关任何对象的各种详细信息,包括文档字符串,函数定义行(用于调用参数)和类的构造函数详细信息。要获取有关对象的特定信息,您可以使用魔术命令%pdoc
,%pdef
,%psource
和%pfile
您还可以使用标准Python help()
function;输出稍微冗长而不是彩色,但是像ipython object?
命令一样。