with open("/home/admin/dsh/dual_camera_system/config/detection.py") as f: c = f.read() c = c.replace("'confidence_threshold': 0.05", "'confidence_threshold': 0.02") c = c.replace("'person_threshold': 0.05", "'person_threshold': 0.02") with open("/home/admin/dsh/dual_camera_system/config/detection.py", "w") as f: f.write(c) print("DONE")