Ticket #239 (new defect)
Opened 14 months ago
Using yaml.dump() after yaml.load() creates different document for block and folded literals
|Reported by:||ceremcem@…||Owned by:||xi|
|Severity:||normal||Keywords:||yaml.load block folded literals|
With folded and block scalars, a document can not be loaded into python code and then dumped as the same. Why?
What I expect is like that:
# original document a: | this is an example block b: > this is another example block
Using this code:
f = open(original_document) result = yaml.dump(yaml.load(f.read())) f.write(result)
# expected result document a: | this is an example block b: > this is another example block
# real result a: 'this is an example block ' b: 'this is another example block '
Yes, there are some other questions on the web ( http://stackoverflow.com/questions/8640959/how-can-i-control-what-scalar-form-pyyaml-uses-for-my-data) but accepted answers does not satisfy my needs.
Am I missing something?