Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8214881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:36:03+00:00 2026-06-07T11:36:03+00:00

Hi have a dictionary word list in bio pythons trie implementation i have a

  • 0

Hi have a dictionary word list in bio pythons trie implementation

i have a trie object named t with a huge dictionary loaded into it.

i have a dict map from integers to a alphabet for some odd encryption algorithm

what is the most elegant or pythonic way so when i search the trie, with a N letter word , to omit and delete all results with length less then or greater then N and only store the results with exact N length

say the inputs are 227 and 8733 which are mapped to letters in the dictionary like ([bar,car,carpet][tree,tree’s,treed,used]) i only want to keep the outputs as the same length, so when the input is 227 only car and bar will be outputted
the results i want should be ([bar,car],[tree,used])

So i want to OMIT all results that would be produced from the trie that have a larger or shorter length then the original input length

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:36:05+00:00Added an answer on June 7, 2026 at 11:36 am
    for word in t.with_prefix(string): # I assume with_prefix() returns a list of words
        if len(word) == len(string):
           words.append(word)
    

    Or using genexpr:

    words.extend(w for w in t.with_prefix(string) if len(w) == len(string))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a T9 dictionary in memory (trie/hash_map). The dictionary contains word-rating pairs, so
I have this kind of list of dictionary [ {'word': u'live', 'sequence': 1L, 'part':
I have an online dictionary. All inputs are saved in table id-word-unixtime. Now I
I have a dictionary, user_dict, and create a list for each user value, this
i have this dictionary: a) 2012 UN NEWNW = ( 2012/06/04 Saudi Arabia Huge
I have an ordered list (a dictionary - 100K words) and many words to
I have a simple requirement (perhaps hypothetical): I want to store english word dictionary
I have a dictionary object IDictionary<string, string> which only has the following items: Item1,
Let's say I have a dict = {...} #lots of words in dictionary I
I have a Word model for a dictionary/thesaurus: public class Word { public virtual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.