Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
列表元素在ipython中的制表符完成_Python_Autocomplete_Ipython_Jupyter_Ipdb - Fatal编程技术网

列表元素在ipython中的制表符完成

列表元素在ipython中的制表符完成,python,autocomplete,ipython,jupyter,ipdb,Python,Autocomplete,Ipython,Jupyter,Ipdb,以下是tab completion对我的作用: In [84]: a="string" In [85]: b = ["str", "ing"] 字符串的制表符完成在此处工作: In [86]: a. a.capitalize a.decode a.expandtabs a.index a.isdigit a.istitle a.ljust a.partition a.rindex a.rsplit a.splitl

以下是tab completion对我的作用:

In [84]: a="string"

In [85]: b = ["str", "ing"]
字符串的制表符完成在此处工作:

In [86]: a.
a.capitalize  a.decode      a.expandtabs  a.index       a.isdigit     a.istitle     a.ljust       a.partition   a.rindex      a.rsplit      a.splitlines  a.swapcase    a.upper       
a.center      a.encode      a.find        a.isalnum     a.islower     a.isupper     a.lower       a.replace     a.rjust       a.rstrip      a.startswith  a.title       a.zfill       
a.count       a.endswith    a.format      a.isalpha     a.isspace     a.join        a.lstrip      a.rfind       a.rpartition  a.split       a.strip       a.translate   
In [86]: b.
b.append   b.count    b.extend   b.index    b.insert   b.pop      b.remove   b.reverse  b.sort     
In [87]: b[0].
列表的制表符完成在此处工作:

In [86]: a.
a.capitalize  a.decode      a.expandtabs  a.index       a.isdigit     a.istitle     a.ljust       a.partition   a.rindex      a.rsplit      a.splitlines  a.swapcase    a.upper       
a.center      a.encode      a.find        a.isalnum     a.islower     a.isupper     a.lower       a.replace     a.rjust       a.rstrip      a.startswith  a.title       a.zfill       
a.count       a.endswith    a.format      a.isalpha     a.isspace     a.join        a.lstrip      a.rfind       a.rpartition  a.split       a.strip       a.translate   
In [86]: b.
b.append   b.count    b.extend   b.index    b.insert   b.pop      b.remove   b.reverse  b.sort     
In [87]: b[0].
字符串的制表符完成在此处不起作用:

In [86]: a.
a.capitalize  a.decode      a.expandtabs  a.index       a.isdigit     a.istitle     a.ljust       a.partition   a.rindex      a.rsplit      a.splitlines  a.swapcase    a.upper       
a.center      a.encode      a.find        a.isalnum     a.islower     a.isupper     a.lower       a.replace     a.rjust       a.rstrip      a.startswith  a.title       a.zfill       
a.count       a.endswith    a.format      a.isalpha     a.isspace     a.join        a.lstrip      a.rfind       a.rpartition  a.split       a.strip       a.translate   
In [86]: b.
b.append   b.count    b.extend   b.index    b.insert   b.pop      b.remove   b.reverse  b.sort     
In [87]: b[0].
一种可能的解决方法:

In [88]: c = b[0]

In [89]: c.
c.capitalize  c.decode      c.expandtabs  c.index       c.isdigit     c.istitle     c.ljust       c.partition   c.rindex      c.rsplit      c.splitlines  c.swapcase    c.upper       
c.center      c.encode      c.find        c.isalnum     c.islower     c.isupper     c.lower       c.replace     c.rjust       c.rstrip      c.startswith  c.title       c.zfill       
c.count       c.endswith    c.format      c.isalpha     c.isspace     c.join        c.lstrip      c.rfind       c.rpartition  c.split       c.strip       c.translate   

是否可以在没有提及解决方法的情况下使用补全?我在ipdb中遇到了类似的行为,是否可以在那里修复此行为?我使用的是iPython v3.1.0和ipdb V0.8。感谢创建ipython个人资料:

ipython profile create testing
ipython_config.py中取消对此行的注释

# 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.IPCompleter.greedy = True
使用此配置文件加载IPython:

ipython notebook --profile=testing
这为列表成员和字典键和值提供了制表符完成


一种快速的替代方法是使用dir()方法:



另一种方法是在PTV中使用Python或IPython交互控制台或常规编辑器,它能够对列表元素进行补全(intellisense)。

是的,但这是另一种解决方法。主要目标是使用tab键。一些配置,如bash的/etc/bash\u completion,会很好。使用jedi进行重构时,会考虑使用ipython自动完成:谢谢,这很有效:)注意,ipython必须作为
ipython--profile=testing
启动。三个问题1。你所说的“(I)Python控制台”是什么意思。在ipdb中是否也可以启用此功能,我想更改默认配置文件可能是一种方法?3.你是怎么想出来的?我现在已经将
profile\u testing
重命名为
profile\u default
当我开始
ipython
完成列表工作时,但是当我开始
python-mipdb script.py
它就不工作了,你知道吗?