def get_word():
    s = ''
while True:
    a = getkey()
if a == '\n':
    break
elif a == '\t':
    print('all possibilities')
else:
    s += a
return s
word = get_word()
print(word)
How to code autocompletion in python?