Possible Duplicate:
Replace four letter word in python
I want write a file in the python shell, run a program in it, and then close the file.
Here is the code I have right now.
def censor(fileName):
file = open(fileName, "r")
for i in len(myList):
censoredFile = open("censored.txt", "w")
outputFile.write(censoredFile)
outputFile.close()
The program I want to run isn’t in the program yet because I’m just trying to figure out how to deal with files. I have some programming experience but not a lot with files. Any input would be appreciated.
Thanks!
This is the code you need to read a file, replace all the four letter word and write the final result into a different file.
It should be it.