Advertisement
dvdjaco

8.4

Feb 18th, 2012
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. # #!/usr/bin/python
  2. #
  3. # By dvdjaco
  4. # Exercise 8.4
  5. #
  6.  
  7. fhand = open('romeo.txt')
  8. wordlist = []
  9. for line in fhand:
  10.         words = line.split()
  11.         for word in words:
  12.                 word = str.lower(word) #lowercase strings before comparing
  13.                 if word in wordlist: continue
  14.                 wordlist.append(word)
  15.                
  16. wordlist.sort()
  17. print wordlist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement