Python中的Tab補全功能添加

來源:互聯網
上載者:User

標籤:nbsp   如何   oct   python   register   error   bit   edit   for   

用 Python shell 沒有 Tab 補全還是挺痛苦的,下面就記錄一下如何補全:

1. 先準備一個 tab.py 的指令碼。

 >>> tap.py

 1 #!/usr/bin/python 2 # python tab file 3    4 import sys 5 import readline 6 import rlcompleter 7 import atexit 8 import os 9 # tab completion10 readline.parse_and_bind(‘tab: complete‘)11 # history file12 histfile = os.path.join(os.environ[‘HOME‘], ‘.pythonhistory‘)13 try:14     readline.read_history_file(histfile)15 except IOError:16     pass17 atexit.register(readline.write_history_file, histfile)18   19 del os, histfile, readline, rlcompleter

2. 查看Python預設的模組存放地址

1 Python 3.6.3 (v3.6.3:2c5fef8, Oct 3 2017, 18:22:56) [MSG v.1900 64 bit (AMD64)] on win32 2 Type "help", "copyright", "credits" or "license" for more information.  3 >>> import string   4 >>> string .__file__  5 ‘C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\string.py‘

3. 拷貝該指令碼到預設模組存放路徑

 >>> ‘C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\‘

4. 現在可以用了.hhhhhhhhhhh

    

 

 

 

 

   

Python中的Tab補全功能添加

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.