Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import cgi,words,cgitb
- cgitb.enable()
- print "Content-type: text/html\n\n"
- print """
- Search in our beloved dictionary.<br/>
- <form method = 'get' action = ''>
- <input type = 'text' name = 'wor
- <input type = 'submit' value = 'Search'/>
- </form>
- """
- english_dict = words.words
- form = cgi.FieldStorage()
- if form.has_key('word'):
- word = form['word'].value
- word = word.split()
- filters = ['and','but','or','so','there','was','a','is','an','of']
- for x in filters:
- if x in word:
- word.remove(x)
- word_value = len(word)
- for x in english_dict:
- t = 0
- for words in word:
- if words in english_dict[x]:
- t = t+1
- if t == word_value:
- print "<b>"+x+"</b>: "+english_dict[x]+"<br/>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement