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