String find and replace

Erik Max Francis max at
Wed Aug 27 04:48:24 CEST 2003

hokiegal99 wrote:

> I hate to answer my own post, but I think I understand what I'm doing
> wrong. I'm finding and replacing 'this' with 'that' in the varible
> named
> mystr, not the actual files. So, how would I go about making the
> change
> to the actual files instead of a variable that contains their content?


	inputFile = file(filename, 'r')
	data =
	data = data.replace(this, that)
	outputFile = file(filename, 'w')

   Erik Max Francis && max at &&
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ There never was a good war or a bad peace.
\__/  Benjamin Franklin

More information about the Python-list mailing list