toml-lang / toml

Tom's Obvious, Minimal Language
https://toml.io
MIT License
19.45k stars 847 forks source link

Dump Multiline string to toml file #968

Closed reisenmachtfreude closed 1 year ago

reisenmachtfreude commented 1 year ago

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?

marzer commented 1 year ago

This is the repository for the TOML language, not any particular implementation. You'll need to find the github or package repository for the implementation you're using and ask your question there.

Looks like python, might be one of:

(there are others, too.)

reisenmachtfreude commented 1 year ago

Great! Thank you very much!