对象列表或目录的Ipython自动完成

对象列表或目录的Ipython自动完成,ipython,ipython-notebook,jupyter,qtconsole,Ipython,Ipython Notebook,Jupyter,Qtconsole,对于以下情况,我希望在IPython(Jupyter qtconsole或console)中具有自动完成功能: 我创建了一个类 class MyClass(object): def __init__(self, a, b): self.a = a self.b = b 并将该类的多个对象放入列表或dict中 my_list = [] my_list.append(MyClass(2,3)) my_list.append(MyClass(9,2)) my_

对于以下情况,我希望在IPython(Jupyter qtconsole或console)中具有自动完成功能:

我创建了一个类

class MyClass(object):
    def __init__(self, a, b):
        self.a = a
        self.b = b
并将该类的多个对象放入列表或dict中

my_list = []
my_list.append(MyClass(2,3))
my_list.append(MyClass(9,2))
my_list.append(MyClass(8,4))
现在如果我这样做了

my_list[0].TAB
自动完成不起作用

我想看看我的类属性和方法的列表。是我遗漏了什么,还是这在IPython中不受支持


感谢您的帮助…

您可以在Jupyter笔记本的一个单元格中执行此操作:

%config IPCompleter.greedy=True
它提供(在ipython/jupyter控制台中,但在笔记本中相同)

如果在
~/.ipython/profile\u default/
中没有
ipython\u config.py
,则可以创建一个:

ipython profile create

谢谢。工作完美。该选项仍在
ipython\u config.py
中,您很可能会在这里找到
~/.ipython/profile\u default/ipython\u config.py
。如果它不存在,您可以使用
ipython profile create
创建它。因为IPython不再支持配置文件。但是,默认配置文件仍然可以更改。@弗雷德,啊,你对
ipython_配置文件的看法是正确的,我只是在查看另一个配置文件中的另一个配置文件,这就是它不起作用的原因。谢谢,我会相应地编辑。
#------------------------------------------------------------------------------
# Completer configuration
#------------------------------------------------------------------------------

# Activate greedy completion
# 
# This will enable completion on elements of lists, results of function calls,
# etc., but can be unsafe because the code is actually evaluated on TAB.
c.Completer.greedy = True # <-- uncomment this line and set it to True
ipython profile create