Win10 (PowerShell) under Python Command line tab auto Completion

Source: Internet
Author: User
Tags readline

Use Python to debug simple programs directly from the command line.

WIN10 (PowerShell) Without tab completion, the operation is really troublesome.

Online search learned, record, review with, hahaha

Environment: WIN10 64-bit Python2,python3One: Install the Pyreadline module
Pip Install Pyreadline # python2pip3 install Pyreadline # Python3
Ii. Preparation of tab.py

File saved in: \python2\lib\tab.py

例如:D:\Program Files\Python2\Lib\tab.py
python2 python3要使用TAb自动补全都要在对应的lib中建立tab.py文件
#python tabimport sys   import readline   import rlcompleter   import atexit   import os    readline.parse_ And_bind (' Tab:complete ')   # windowshistfile = Os.path.join (os.environ[' HomePath '], '. Pythonhistory ')   # Linux # 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  
Third, the effect test

Use Import tab to introduce tab completion

# Python2

# Python3

# After testing found that Python2 need to import tab to support auto-completion, and then python3 do not need to import tab to support auto-completion, do not know that is not my more special??

 

Win10 (PowerShell) Python Command line 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.