Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding:Utf-8 -*-
- with open("D:/tmp/The Adventures of Sherlock Holmes.txt") as f:
- text = f.read()
- wordDict = {}
- for i in text.split(" "):
- wordLen = len(i)
- if not wordLen in wordDict:
- wordDict[wordLen] = []
- wordDict[wordLen].append(i)
- print [wordDict[n][0] for n in sorted(wordDict, reverse=True)][:3]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement