Created
April 15, 2017 07:01
-
-
Save christabor/0945195e65a983f505b2ad0b20d05705 to your computer and use it in GitHub Desktop.
GOVT WORDS
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
import os | |
import sys | |
from random import choice | |
def get_dict_words(): | |
"""Get some words from local dict.""" | |
# Choices: web2, words, web2a, connectives, propernames | |
folder = 'words' | |
osx_words = '/usr/share/dict/{}'.format(folder) | |
with open(osx_words, 'r') as wordfile: | |
words = wordfile.readlines() | |
return words | |
if __name__ == '__main__': | |
maxnum = int(sys.argv[1]) | |
words = get_dict_words() | |
govwords = [ | |
'{fst}{scnd}'.format( | |
fst=choice(words).upper().replace('\n', ''), | |
scnd=choice(words).upper().replace('\n', '') | |
) | |
for _ in range(maxnum) | |
] | |
print('\n'.join(govwords)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment