Counting Words in Python

Well, I have my first successful Python script, but it isn’t quite doing what I want:

#! /usr/bin/env python 

import nltk  
input = open('/Users/john/Dropbox/python/mm.txt', 'r')  
text =  
lexicon = sorted(set(text))  
print lexicon  
output = open('/Users/john/Dropbox/python/mm-wf2.txt', 'w')  

Great stuff. Unfortunately my results are less than stellar — and, worse, while it will output to the command line, my code above creates only an empty file. Sigh.