Python Command line tab completion for Mac system

Source: Internet
Author: User

Create a new ~/.pythonstartup file and write the following:

$ cat ~/.pythonstartup Import sysimport readlineimport rlcompleterif sys.platform = = ' Darwin ' and sys.version_info[0] = = 2 : Readline.parse_and_bind ("Bind ^i Rl_complete") else:readline.parse_and_bind ("Tab:complete")


Then set the environment variable Pythonstartup, can be set in the ~/.bash_profile file of the home directory, append the following line. As follows:

Export pythonstartup= $HOME/.pythonstartup


Reload the ~/.bash_profile configuration file,

. ~/.bash_profile


Set up, you can enter the Python command line terminal, to verify that the tab completion can be done,

 pythonPython 2.7.10  (default, oct 23 2015, 19:19:21)  [gcc 4.1.7  Compatible Apple LLVM 6.8.0  (clang-500.0.11.5)] on darwintype  "Help",   "Copyright",  "credits"  or  "license"  for more information.>>>  import sys>>> print sys.psys.path                 sys.platform             sys.ps2                 sys.path_hooks          sys.prefix               sys.py3kwarning         sys.path_importer_cache sys.ps1           &nbSp;     >>> print sys.p 


Well, it is possible to complete the completion of the verification.

This article is from the "solid-state Drive" blog, make sure to keep this source http://lavenliu.blog.51cto.com/5060944/1791183

Python Command line tab completion for Mac system

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.