79522241

Date: 2025-03-20 08:08:08
Score: 2
Natty:
Report link

In newest version of ruamel-yaml 0.18.10 . If i want to preserve backslash of multiple line string. How should i do.

I use code like below.

import pathlib
from ruamel.yaml import YAML

control_file = 'xx/nist_ocp4.yml'

yaml = YAML()
yaml.preserve_quotes = True
d = yaml.load(pathlib.Path(control_file))
yaml.dump(d, pathlib.Path(control_file))

Before running code:

controls:
- id: AC-1
  status: not applicable
  description: "The organization:\n a. Develops, documents, and disseminates to [Assignment:\
    \ or whenever a significant change occurs]"

After running code:

controls:
- id: AC-1
  status: not applicable
  description: "The organization:\n a. Develops, documents, and disseminates to [Assignment:
    or whenever a significant change occurs]"
Reasons:
  • Blacklisted phrase (1): How should i
  • RegEx Blacklisted phrase (1): i want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Alex Xuan