Skip to content

Instantly share code, notes, and snippets.

@pythonhacker
Last active January 6, 2026 14:02
Show Gist options
  • Select an option

  • Save pythonhacker/db03e8fe3e6d90a91522cc0e23d8e949 to your computer and use it in GitHub Desktop.

Select an option

Save pythonhacker/db03e8fe3e6d90a91522cc0e23d8e949 to your computer and use it in GitHub Desktop.
Demo of the search_word program with bisect module
>>> filename='/usr/share/dict/words'
>>> bt.search_word(filename, 'calculate')
['calculate', 'calculated', 'calculates']
>>> bt.search_word(filename, 'code')
['code', "code's", 'coded', 'codeine', "codeine's", 'codependency', "codependency's", 'codependent',
"codependent's", 'codependents', 'codes', 'codex', "codex's"]
>>> bt.search_word(filename, 'search')
['search', "search's", 'searched', 'searcher', "searcher's", 'searchers', 'searches', 'searching',
'searchingly', 'searchlight', "searchlight's", 'searchlights']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment