检查 ipython 中函数的参数
Checking arguments of a function in ipython
我正在使用 anaconda 的 jupyter ipython notebook。
是否有像我们在 RStudio
中那样快速查看函数参数的方法?例如?merge
在 RStudio 的右下方 window 显示合并文档。
我专门在寻找我在这里找到的 matplotlib.figure()
的参数,但这很耗时:http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.figure
找到与问题相关的post:Getting list of parameter names inside python function
但不确定是不是同一个问题
在命令提示符下键入 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
Exploring your objects
Typing object_name?
will print all sorts of details about any object, including docstrings, function definition lines (for call arguments) and constructor details for classes. To get specific information on an object, you can use the magic commands %pdoc
, %pdef
, %psource
and %pfile
也可以使用标准的Pythonhelp()
function;输出有点冗长而且没有颜色,但是像 ipython object?
命令。
导入后可以试试help(matplotlib.figure)
matplotlib
我正在使用 anaconda 的 jupyter ipython notebook。
是否有像我们在 RStudio
中那样快速查看函数参数的方法?例如?merge
在 RStudio 的右下方 window 显示合并文档。
我专门在寻找我在这里找到的 matplotlib.figure()
的参数,但这很耗时:http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.figure
找到与问题相关的post:Getting list of parameter names inside python function
但不确定是不是同一个问题
在命令提示符下键入 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
Exploring your objects
Typing
object_name?
will print all sorts of details about any object, including docstrings, function definition lines (for call arguments) and constructor details for classes. To get specific information on an object, you can use the magic commands%pdoc
,%pdef
,%psource
and%pfile
也可以使用标准的Pythonhelp()
function;输出有点冗长而且没有颜色,但是像 ipython object?
命令。
导入后可以试试help(matplotlib.figure)
matplotlib