默认选项卡完成,如python控制台中的ipython

时间:2013-07-12 15:01:38

标签: python

我知道我可以用这个:

import rlcompleter, readline
readline.parse_and_bind('tab: complete')

在我的python解释器中启用ipython样式的制表符。

如何在启动python时默认启动运行?

1 个答案:

答案 0 :(得分:3)

将其放入文件.pythonrc(您可以通过环境变量PYTHONSTARTUP控制该文件的名称)。详细了解here

PYTHONSTARTUP
If this is the name of a readable file, the Python commands 
in that file are executed before the first prompt is displayed
in interactive mode. The file is executed in the same namespace
where interactive commands are executed so that objects defined
or imported in it can be used without qualification in the interactive
session. You can also change the prompts sys.ps1 and sys.ps2 in this file.

另见: