Created
November 1, 2014 22:22
-
-
Save larryprice/70e1910241b84d800185 to your computer and use it in GitHub Desktop.
Daily Programmer Challenge #185
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.reddit.com/r/dailyprogrammer/comments/2jt4cx/10202014_challenge_185_easy_generated_twitter/ | |
import re | |
p = re.compile('^at') | |
modified = [] | |
f = open('enable1.txt', 'r') | |
for line in f: | |
if p.match(line): | |
line = line.strip() | |
modified.append(('@' + line[1:], line)) | |
modified.sort(key=lambda tup: len(tup[1])) | |
for word in modified[:10]: | |
print word[0] + " : " + word[1] | |
for word in modified[-10:]: | |
print word[0] + " : " + word[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment