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