TOML Kit

0.14.0 · active · verified Sat Mar 28

TOML Kit is a style-preserving TOML library for Python, currently at version 0.14.0. It offers a parser that maintains comments, indentations, whitespace, and internal element ordering, providing an intuitive API for accessing and editing TOML files. The library is actively maintained with regular updates, as seen in its recent releases.

Warnings

Install

Imports

Quickstart

A quickstart guide demonstrating parsing, modifying, and writing TOML documents using TOML Kit.

from tomlkit import parse, dumps, table

content = """[table]
foo = "bar"  # String
"""
doc = parse(content)
doc['table']['baz'] = 13
tab = table()
tab.add('array', [1, 2, 3])
doc['table2'] = tab
dumps(doc)

view raw JSON →