Salome HOME
Fix bug for package command
[tools/sat.git] / src / __init__.py
index 7a4ac04af6224aa37a7cfb13a3d6c320e771ba2d..10783b7df58df4fccccd9fbc9f91b84d7cad4d17 100644 (file)
@@ -342,3 +342,14 @@ def merge_dicts(*dict_args):
     for dictionary in dict_args:
         result.update(dictionary)
     return result
+
+def replace_in_file(filein, strin, strout):
+    '''Replace <strin> by <strout> in file <filein>
+    '''
+    shutil.move(filein, filein + "_old")
+    fileout= filein
+    filein = filein + "_old"
+    fin = open(filein, "r")
+    fout = open(fileout, "w")
+    for line in fin:
+        fout.write(line.replace(strin, strout))
\ No newline at end of file