Skip to content

Dump Multiline string to toml file #421

@reisenmachtfreude

Description

@reisenmachtfreude

How can I dump an multi-line string to a toml file?
My approach was:

mystr = """Some
content"""
with open('dump.toml', 'w') as f:
  toml.dump({'content' : mystr}, f)

Expected output in toml file:

mystr="""Some
content"""

However, the content was automatically converted to a single line string
mystr="Some\\ncontent"

Is there any code which helps to reach my expected result?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions