1import readline
2readline.parse_and_bind("tab: complete")
3
4def complete(text,state):
5 volcab = ['dog','cat','rabbit','bird','slug','snail']
6 results = [x for x in volcab if x.startswith(text)] + [None]
7 return results[state]
8
9readline.set_completer(complete)
10
11line = input('prompt> ')