This is what I have. I know I am missing something can you help
import string
def main():
print "This program replaces 4 lettter words in a file with xxxx"
# get the sequence of words from the file
fname = raw_input("File to analyze: ")
text = open(fname,'r').read()
text = string.lower(text)
for ch in '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~':
text = string.replace(text, ch, ' ')
words = string.split(text)
wordCount = len(words)
ch = string.split(words)
charCount = len(ch)
if charCount == 4:
oldword = string.join(ch)
newtext = string.join(text)
o = open(fname,a)
for line in open(fname):
line = line.replace(oldword,newword)
o.write(line + "\n")
o.close()
text.close()
main()