Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newline is incorrect #721

Open
CalK16 opened this issue Jun 29, 2023 · 0 comments
Open

newline is incorrect #721

CalK16 opened this issue Jun 29, 2023 · 0 comments
Labels

Comments

@CalK16
Copy link

CalK16 commented Jun 29, 2023

When dumping a dictionary, if the value contains \n, with or without spacing around it will cause the output difference.
Is it expected? are there any way we can align the behavior?

Python 3.10.8 (main, Nov 29 2022, 21:52:51) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> d = {
...     "case1": "test \n test", 
...     "case2": "test\ntest",
... }
>>> print(yaml.dump(d))
case1: "test \n test"
case2: 'test

  test'

>>> 

I am using

PyYAML==6.0
Python3.10.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants