Red Hat 7 Python tab completion

Source: Internet
Author: User

Learn Python recently and summarize how to add a shell script to reach (object.) tab, press 2 to reduce the appearance of all methods.

1, first in the directory:/usr/lib64/python2.7/site-packages below the creation of vim tab.py file.

2. The following contents of the tab.py file:

#!/usr/bin/pythonimport osimport readlineimport rlcompleterimport atexitimport os# tab completionreadline.parse_and_ Bind (' Tab:complete ') # History filehistfile = Os.path.join (os.environ[' HOME '), ' pythonhistory ') try:readline.read_ History_file (histfile) except IOError:passatexit.register (readline.write_history_file,histfile) del Os,histfile, Readline,rlcompleter

Then: chmod 755 tab.py----->./tab.py (Compile);

3, at this time, in the compilation environment into the python, in each use to fill the function before, you must import the package in advance: Import tab

Example:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/88/36/wKioL1fsTerRDXiVAACuq-DPVt0738.png-wh_500x0-wm_3 -wmp_4-s_1321355054.png "title=" Qq20160929071016.png "alt=" Wkiol1fsterrdxivaacuq-dpvt0738.png-wh_50 "/>

Functions beginning with __ are private and cannot be called directly; just call those functions that begin with a letter!!!

This will achieve the function of the tab completion function (premise: The First Import tab module, Import tab);



This article is from the "11586096" blog, please be sure to keep this source http://11596096.blog.51cto.com/11586096/1857584

Red Hat 7 Python tab completion

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.