Python Command line tab instance small coup

Source: Internet
Author: User

Use the Custom tab instance, under the Python command line cannot use the tab to fill the feeling is very uncomfortable has, has looked for the Online tab instance the method, basically all similar.

Reference: Http://askubuntu.com/questions/25605/how-can-i-get-tab-completion-in-the-interactive-python-interpreter

This method is pro-test effective, but involves changing the environment variable what the feeling is a bit troublesome, directly into the module to import more convenient

1. Find the Lib path of Python

# cd/usr/lib/python2.7/site-packages

2,vim tab.py Copy the code in the link is good:

#! /usr/bin/env pythontry:import readlineexcept importerror:print ("Module readline not available.") Else:import rlcompleter readline.parse_and_bind ("Tab:complete")

Look at the effect:

$ Pythonpython 2.7.5 (default, Nov, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on Linux2type "help", "Copyri              Ght "," credits "or" license "for more information.>>> import tab>>> s= ' abc ' >>> SS SetAttr (sorted (str (Slice (Staticmethod (SUM (&G T;>>


Any user can use the Import tab directly.

This article is from the "Always on the Road" blog, please be sure to keep this source http://chenql.blog.51cto.com/8732050/1908978

Python Command line tab instance small coup

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.