I want to make input () a nice complement in python

If you use readline module (not GNU readline) when input () in readline (raw_input () in python2), it feels good to complete with tab, but I'm troubled because there is not too much information. Talk

It seems that you should do it properly with folders and completion, but if you want to do it with any list, the following contents will be helpful. https://stackoverflow.com/questions/18369207/python-user-input-replay

In short, make up the Completer class

readline.parse_and_bind("tab: complete")
readline.set_completer(completer.complete)

It seems that you will be able to complete with tab when you do something like input ()

If you are using Windows

$ pip install pyreadline

It feels good to do (I'm happy with cross-platform because it works with import readline without import pyreadline, at least it worked in my environment)

A little more complicated example: https://stackoverflow.com/questions/5637124/tab-completion-in-pythons-raw-input

Recommended Posts

I want to make input () a nice complement in python
I want to create a window in Python
I want to make a game with Python
I want to embed a variable in a Python string
I want to easily implement a timeout in python
I want to write in Python! (2) Let's write a test
I want to randomly sample a file in Python
I want to work with a robot in python.
[Python] I want to make a nested list a tuple
I tried to make a stopwatch using tkinter in python
I want to build a Python environment
[Introduction] I want to make a Mastodon Bot with Python! 【Beginners】
I want to make matplotlib a dark theme
I want to do Dunnett's test in Python
I want to merge nested dicts in Python
I want to write to a file with Python
I want to display the progress in Python!
I want to convert a table converted to PDF in Python back to CSV
I want to color a part of an Excel string in Python
A note I looked up to make a command line tool in Python
I want to make a web application using React and Python flask
I want to do a monkey patch only partially safely in Python
Make a bookmarklet in Python
I want to write in Python! (1) Code format check
I want to iterate a Python generator many times
I want to generate a UUID quickly (memorandum) ~ Python ~
I want to transition with a button in flask
I tried to implement a pseudo pachislot in Python
I want to write in Python! (3) Utilize the mock
I want to use the R dataset in python
I want to run a quantum computer with Python
I want to do something in Python when I finish
I want to manipulate strings in Kotlin like Python!
I want to create a nice Python development environment for my new Mac
I want to create a priority queue that can be updated in Python (2.7)
Python program is slow! I want to speed up! In such a case ...
I tried to implement a one-dimensional cellular automaton in Python
I want to do something like sort uniq in Python
I want to use a python data source in Re: Dash to get query results
I want to make a blog editor with django admin
[Python] I want to get a common set between numpy
I want to start a lot of processes from python
[Mac] I want to make a simple HTTP server that runs CGI with Python
I want to make a click macro with pyautogui (desire)
I tried "How to get a method decorated in Python"
I want to make a click macro with pyautogui (outlook)
I want to write a triple loop and conditional branch in one line in python
I want to send a message from Python to LINE Bot
I want to make the Dictionary type in the List unique
I want to be able to run Python in VS Code
I want to debug with Python
[Python] I want to make a 3D scatter plot of the epicenter with Cartopy + Matplotlib!
I want to see the graph in 3D! I can make such a dream come true.
When I got a list of study sessions in Python, I found something I wanted to make
I want to make a voice changer using Python and SPTK with reference to a famous site
[5th] I tried to make a certain authenticator-like tool with python
I want to use a wildcard that I want to shell with Python remove
[2nd] I tried to make a certain authenticator-like tool with python
How to make a string into an array or an array into a string in Python
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
I tried to make a regular expression of "amount" using Python