Skip to main content

HTML Table Parse

A lightweight HTML table parser that converts tables to Python data structures without pandas.

Installation

pip install html-table-parse

Usage

from html_table_parse import to_list, to_dict, to_dicts

html = """
<table>
    <tr><th>Name</th><th>Age</th><th>City</th></tr>
    <tr><td>Alice</td><td>30</td><td>NYC</td></tr>
    <tr><td>Bob</td><td>25</td><td>LA</td></tr>
</table>
"""

# List of lists
to_list(html)
# [['Name', 'Age', 'City'], ['Alice', '30', 'NYC'], ['Bob', '25', 'LA']]

# Dictionary of columns
to_dict(html)
# {'Name': ['Alice', 'Bob'], 'Age': ['30', '25'], 'City': ['NYC', 'LA']}

# List of dictionaries
to_dicts(html)
# [{'Name': 'Alice', 'Age': '30', 'City': 'NYC'}, 
#  {'Name': 'Bob', 'Age': '25', 'City': 'LA'}]

Features

  • No pandas required - lightweight alternative to pandas.read_html()
  • Supports colspan and rowspan attributes
  • Handles duplicate headers (auto-numbered)
  • Multiple output formats: lists, dict of columns, or list of dicts
  • Automatic whitespace normalization
  • Fast parsing with lxml

API

to_list(html: str, index: int = 0) -> list[list]

Parse table as list of rows.

to_dict(html: str, index: int = 0) -> dict[str, list]

Parse table as dictionary of columns (first row = headers).

to_dicts(html: str, index: int = 0) -> list[dict]

Parse table as list of dictionaries (first row = headers).

Metadata

Release files for html-table-parse 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html-table-parse 0.2.2
File Size Uploaded Provenance Actions
html_table_parse-0.2.2.tar.gz 3.2 kB Without provenance Details for html_table_parse-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for html-table-parse 0.2.2
File Interpreter ABI Platform Actions
html_table_parse-0.2.2-py3-none-any.whl Python 3 none any Details for html_table_parse-0.2.2-py3-none-any.whl

Total release size: 6.7 kB

Release files / html_table_parse-0.2.2.tar.gz

Download URL html_table_parse-0.2.2.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4c57fcfc440f54bb476902e14775d06007e06718ea4f04b077bd315cff058ffc
BLAKE2b-256 checksum
How to use checksums
46ff9a6a96081f387e16a6e1f2cd0fb2d546ee11b411ced57f37d371402e4c27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / html_table_parse-0.2.2-py3-none-any.whl

Download URL html_table_parse-0.2.2-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8e202c8f193ed20fba0d49a7f0b526461cc4e4b4cfb46b0372b4d8a915f28f1
BLAKE2b-256 checksum
How to use checksums
79f88be73d481d99f68767fb8e65ffea968992c0712fd033d7a8244281a00d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for html-table-parse 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page