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