gg wrote: > I plan to write a program in Python in order to help me doing > crosswords, I was wondering if such a program already existed. > > Basically it will get the number of letters of the word (5, 10, 12...) > then the letters known (B in second letter, E in 5th letter...) and then > search in a dictionary the words matching this criteria > > Regards > > Gerard
Pretty straightforward with a regular expression: import re words = ["BULLETIN", "BALLPARK", "BUSINESS"] r = re.compile("^BU..N..S$", re.IGNORECASE) for word in words: if r.match(word): print word You would probably want to allow the user to input both some basic format for your program and convert it to a regular expression as well as input a full pattern, because then the user can have words that have a U or a E in the second letter, simply because he doesn't know which one is right yet. -- Lasse Vågsæther Karlsen http://usinglvkblog.blogspot.com/ mailto:[EMAIL PROTECTED] PGP KeyID: 0x2A42A1C2 -- http://mail.python.org/mailman/listinfo/python-list