Trying to search through a txt file and replace a few values.

Discussion created by sb52191 on Oct 1, 2013
Latest reply on Oct 3, 2013 by gabrisch
I'm trying to write code to search through txt files and, when I come across certain keywords like 'lines= 55555', replace the value with a new number. I'm trying to use the open(files, 'r'), but then the .replace function doesn't seem to do anything. If I try and use 'w', then I just get a blank document. Obviously I don't really now how these work, so any general tips would be greatly appreciated.