Version-Specific Features

Python 3.14 — Zstandard compression

The compression.zstd module supports Zstandard compressed data. Compression is lossless; decompression of untrusted data requires resource limits. Availability may depend on how Python was built. Requires Python 3.14 or the relevant build; example is not executed locally.

Formal Syntax & Structure

python syntaxpython
compression.zstd.compress(data) / decompress(data)

Return Value

Feature-specific

No single return type; see the example and feature description.

Working Example

Example Snippetpython
from compression import zstddata = b'abc' * 100print(zstd.decompress(zstd.compress(data)) == data)
Python Reference