Skip to content

Preserve single quote in output #741

Open
@jerryhxu

Description

@jerryhxu

I encountered an issue with preserving the single quote in output yaml file. Here is a simple example:

import yaml

random_condition = """
    - type: value
      key: some_id
      value:
        - '04549'
        - '24543'
"""

names = yaml.safe_load(random_condition)
with open('names.yml', 'w') as file:
    yaml.safe_dump(names, file)
print(open('names.yml').read())

The output yaml will display the following:

value: 
    - 04549
    - '24543'

Notice that the single quote around 04959 is not preserved. Does anyone know how to fix it? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions