toml-lang / toml

Tom's Obvious, Minimal Language

Home Page:https://toml.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dump Multiline string to toml file

reisenmachtfreude opened this issue · comments

commented

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?

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.)

commented

Great! Thank you very much!