Tomli

2.4.1 · active · verified Sat Mar 28

Tomli is a Python library for parsing TOML (Tom's Obvious, Minimal Language) files, fully compatible with TOML v1.0.0. As of version 2.4.1, it provides a backport of the standard library's `tomllib` module introduced in Python 3.11, ensuring compatibility for earlier Python versions. The library is actively maintained, with regular updates to enhance functionality and maintain compatibility.

Warnings

Install

Imports

Quickstart

This example demonstrates how to parse a TOML file named 'config.toml' and print its contents as a Python dictionary.

import tomli

with open('config.toml', 'rb') as f:
    config = tomli.load(f)

print(config)

view raw JSON →