把這個文件導入到python自帶的IDE下,再按TAB鍵就會有提示
須要readline庫,在新的版本中,可能名字是gnureadline庫, python
須要pip install gnureadline 或 pip install readline
也能夠在pipy.python.org下載源碼進行 /opt/python35/bin/python3 setup.py install 安裝
但可能提示:依賴 ncurses ncurses-devel ,readline readline-devel
能夠yum install ncurses ncurses-devel readline readline-devel code
cat tab.py #!/opt/python35/bin/python3 # python startup file import sys import readline import rlcompleter import atexit import os # tab completion readline.parse_and_bind('tab: complete') # history file histfile = os.path.join(os.environ['HOME'], '.pythonhistory') try: readline.read_history_file(histfile) except IOError: pass atexit.register(readline.write_history_file, histfile) del os, histfile, readline, rlcompleter如今,只要導入import tab按tab就能夠實現提示和補全了,
轉貼的,網上處處都是,確實不知道是抄的那裏了。 ip