Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # empty word list created
- wrd_list = []
- filename = raw_input("Enter file name: ")
- for line in open(filename):
- wrd_list.extend(line.split())
- # used set built-in function to remove repeated string
- wrd_set = set(wrd_list)
- # converted the set back to list using the list built-in function
- wrd_list = list(wrd_set)
- wrd_list.sort() # sorting was done
- print wrd_list # bingo!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement