首页 > 代码库 > Python终端自动补全

Python终端自动补全

在~目录下添加一个文件,名字为.pythonstartup.py

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import readline, rlcompleter;
readline.parse_and_bind("tab: complete"); # 启用Tab补全

def igtk():
   globals()[‘gtk‘] = __import__(‘gtk‘);
   globals()[‘thread‘] = __import__(‘thread‘);
   gtk.gdk.threads_init();
   thread.start_new_thread(gtk.main, ());
   pass;

 然后在.bashrc中添加

export PYTHONSTARTUP=~/.pythonstartup.py

 

Python终端自动补全