Skip to content

Instantly share code, notes, and snippets.

@johnpneumann
Created August 14, 2012 20:19
Show Gist options
  • Save johnpneumann/3352496 to your computer and use it in GitHub Desktop.
Save johnpneumann/3352496 to your computer and use it in GitHub Desktop.
Random Animal, Verb, Adjective
"""
Waiting for OSX to install so I did this.
Words from here:
http://dictionary-thesaurus.com/wordlists.html
"""
import sys
import random
import urllib2
def main():
animals = random.sample(urllib2.urlopen('http://dictionary-thesaurus.com/wordlists/Animals%2865%29.txt').readlines(), 20)
verbs = random.sample(urllib2.urlopen('http://dictionary-thesaurus.com/wordlists/ExpressiveVerbs%28160%29.txt').readlines(), 20)
adjectives = random.sample(urllib2.urlopen('http://dictionary-thesaurus.com/wordlists/Adjectives%28929%29.txt').readlines(), 20)
pretty_animals = [obj.rstrip('\r\n') for obj in animals]
pretty_verbs = [obj.rstrip('\r\n') for obj in verbs]
pretty_adjectives = [obj.rstrip('\r\n') for obj in adjectives]
crazy_animals = dict(zip(pretty_animals, zip(pretty_verbs, pretty_adjectives)))
msg = 'Your animals:%s' % (crazy_animals)
sys.stdout.write('%s\n' % (msg))
return crazy_animals
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment