In PHP, I had this line. matches = preg_grep('/^for/', array_keys($hash));What she would do is grab the words: fork, form, etc., which are in $ hash.
In Python, I have a dict with 400,000 words. Keys are words that I would like to represent as autocomplete (meaning in this case does not make sense). How can I return the keys from my dictionary matching the input?
For example (as used previously) if I have
my_dic = t{"fork" : True, "form" : True, "fold" : True, "fame" : True}
and I get some input "for", it returns a list "fork", "form".
source
share