This program searches for words in a given file based on specific filtering criteria. It allows users to filter words by length, excluded letters, included letters with specific indices, and included letters with excluded indices.
- Filter words based on length.
- Exclude words containing specific letters.
- Include words with specific letters at specific positions.
- Exclude words with specific letters at certain positions.
Run the program from the command line with the following arguments:
file- Path to the file containing a list of words.length- Desired length of the words.
--not_containor-nc- Letters that should not be present in the word.--contain_displaceor-cd- Letters that must be present but cannot be at specific indices. Format:<char><i>(e.g.,a0for 'a' cannot be at index 0).--containor-c- Letters that must be present at specific indices. Format:<char><i>(e.g.,b2for 'b' at index 2).
python script.py .txt 5 -nc xyz -cd 'a0 b1' -c 'c2 d3'- Python 3.x
- A text file containing the list of words, one word per line.
- Reads words from the provided file.
- Filters words based on the specified criteria.
- Outputs the filtered list of words.