def replace_all(filepath, searchExp, replaceExp):
for line in fileinput.input(filepath, inplace=<NUM_LIT:1>):<EOL><INDENT>if searchExp in line:<EOL><INDENT>line = line.replace(searchExp, replaceExp)<EOL><DEDENT>sys.stdout.write(line)<EOL><DEDENT>
Replace all the ocurrences (in a file) of a string with another value.