markdowntable

raw JSON →
6.0.0 verified Sat May 09 auth: no python

A Python library for creating Markdown tables easily. Version 6.0.0 supports Python 3.7+ and provides a simple API to generate table strings. Earlier versions had different import paths and API.

pip install markdowntable
error AttributeError: module 'markdowntable' has no attribute 'MarkdownTable'
cause Importing the class name instead of the module.
fix
Use import markdowntable and table = markdowntable.create(...).
error TypeError: create() missing 2 required positional arguments: 'header' and 'rows'
cause Calling `create()` without required arguments.
fix
Provide both header (list of strings) and rows (list of lists).
breaking In v6.0.0, the API changed from class-based to module-level functions. Importing `MarkdownTable` from `markdowntable` will fail.
fix Use `import markdowntable` and call `markdowntable.create()` instead.
deprecated The `MarkdownTable` class was deprecated in v5.x and removed in v6.0.0. Code using `from markdowntable import MarkdownTable` will break.
fix Migrate to `import markdowntable` and use `markdowntable.create()`.
gotcha The `create()` function expects a list of lists for `rows`, not a list of dicts or tuples. Mixing types may cause errors or incorrect table output.
fix Ensure each row is a list of values matching the header length.

Create a simple markdown table with header and rows.

import markdowntable

table = markdowntable.create(
    header=["Name", "Age", "City"],
    rows=[
        ["Alice", 30, "New York"],
        ["Bob", 25, "London"],
        ["Charlie", 35, "Paris"]
    ]
)
print(table)