📌  相关文章
📜  如何在 python 代码示例中提供自动完成功能

📅  最后修改于: 2022-03-11 14:45:53.690000             🧑  作者: Mango

代码示例1
import readline
readline.parse_and_bind("tab: complete")

def complete(text,state):
    volcab = ['dog','cat','rabbit','bird','slug','snail']
    results = [x for x in volcab if x.startswith(text)] + [None]
    return results[state]

readline.set_completer(complete)

line = input('prompt> ')