How to code autocompletion in python?

前端 未结 6 1789
暖寄归人
暖寄归人 2020-11-27 11:20

I\'d like to code autocompletion in Linux terminal. The code should work as follows.

It has a list of strings (e.g. \"hello, \"hi\", \"how are you\", \"goodbye\", \"

6条回答
  •  余生分开走
    2020-11-27 11:45

    To enable autocomplete in a Python shell, type this:

    import rlcompleter, readline
    readline.parse_and_bind('tab:complete')
    

    (thanks to http://blog.e-shell.org/221)

提交回复
热议问题