Skip to content

Instantly share code, notes, and snippets.

@christabor
Created April 15, 2017 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christabor/0945195e65a983f505b2ad0b20d05705 to your computer and use it in GitHub Desktop.
Save christabor/0945195e65a983f505b2ad0b20d05705 to your computer and use it in GitHub Desktop.
GOVT WORDS
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