In honor of NaNoWriMo, I (Zach) wrote some python code to help you participate in this month of novel writing. The code below will read a text file online that contains a list of English words, then print out fifty-thousand of them for your brand new novel!
NaNoWriMo instant winner code
from random import randint
word_site = "http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsEn.txt"
response = urllib2.urlopen(word_site)
txt = response.read()
WORDS = txt.splitlines()
myNovel = "Once upon a time,"
for x in range(1, 50000):
if(x % 12 == 0):
myNovel = myNovel + "."
myNovel = myNovel + " " + WORDS[randint(0,len(WORDS))]
myNovel = myNovel + ". The End."
I found out that changing that 50000 to something smaller, like 7, can generate some profound little stories. Take a look at this artistic gem, for example: Once upon a time, moneybag heinous jellybeans wifeless sweetbreads overheat. The End.
Or even better, write a drabble!