Skip to content

Instantly share code, notes, and snippets.

@OsKaR31415
OsKaR31415 / python list to markdown table.md
Last active August 14, 2024 08:29
python list to markdown table.md

Here is a function to convert a python list of lists into a markdown formatted table:

def make_markdown_table(array, align: str =None):
    """
    Args:
        array: The array to make into a table. Mush be a rectangular array
               (constant width and height).
 align: The alignment of the cells : 'left', 'center' or 'right'.