Structured Data Modules
tomllib
Parse TOML 1.0 configuration into Python dictionaries. loads() accepts text, load() accepts a binary file object, and parse_float can substitute a numeric parser. There is no TOML writer in this module. Invalid TOML raises TOMLDecodeError; bound untrusted input.
Formal Syntax & Structure
python syntaxpython
import tomllibReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import tomllibconfig = tomllib.loads('[server]\nport = 8080\nactive = true')print(config["server"]["port"], config["server"]["active"])