Using the TAB key in Python (Python3 valid)

Source: Internet
Author: User

Import this file into Python's IDE and press TAB to prompt
The ReadLine library is required, and in the new version, the name may be Gnureadline library,

Requires pip install Gnureadline or pip install ReadLine
You can also download the source code for/opt/python35/bin/python3 setup.py install in pipy.python.org
But may hint: rely on ncurses ncurses-devel, ReadLine readline-devel
Can yum install ncurses ncurses-devel readline readline-devel

Cat tab.py #!/opt/python35/bin/python3# python startup fileimport sysimport 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
Now, you can prompt and complete the Import tab by pressing TAB.
You can actually put the file in the Python program's library path.

Posted, online everywhere is, indeed do not know is copied there.

Using the TAB key in Python (Python3 valid)

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.