html-table-parser-python3
This module consists of just one small class. Its purpose is to parse HTML tables without help of external modules. Everything used is part of python 3.
Installation
pip install html-table-parser-python3
How to use
Example Usage:
import urllib.request
from pprint import pprint
from html_table_parser_python3 import HTMLTableParser
def url_get_contents(url):
""" Opens a website and read its binary contents (HTTP Response Body) """
req = urllib.request.Request(url=url)
f = urllib.request.urlopen(req)
return f.read()
def main():
url = 'http://www.twitter.com'
xhtml = url_get_contents(url).decode('utf-8')
p = HTMLTableParser()
p.feed(xhtml)
pprint(p.tables)
if __name__ == '__main__':
main()
The parser returns a nested lists of tables containing rows containing cells as strings. Tags in cells are stripped and the tags text content is joined. The console output for parsing all tables on the twitter home page looks like this:
>>>
[[['', 'Anmelden']],
[['Land', 'Code', 'Für Kunden von'],
['Vereinigte Staaten', '40404', '(beliebig)'],
['Kanada', '21212', '(beliebig)'],
...
['3424486444', 'Vodafone'],
['Zeige SMS-Kurzwahlen für andere Länder']]]
Credit
All Credit goes to Josua Schmid (schmijos). This is all his work, I just uploaded it to PyPi. Original repository can be found at:
https://github.com/schmijos/html-table-parser-python3
License
GNU GPL v3
Metadata
Release files for html-table-parser-python3 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| html-table-parser-python3-0.1.3.tar.gz | 3.1 kB | Without provenance | Details for html-table-parser-python3-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| html_table_parser_python3-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for html_table_parser_python3-0.1.3-py3-none-any.whl |
Total release size: 6.7 kB
Release files / html-table-parser-python3-0.1.3.tar.gz
| Download URL | html-table-parser-python3-0.1.3.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
621b7beec3d168dba87e9da064096fde2a7d62f92b7de3449f0c0727a88ee417
|
|
BLAKE2b-256 checksum How to use checksums |
1f8fe5990b18b02f2e0febc87dc2bdba49c6b93ce8ae520598f9db69f3ff0ab2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
|
Release files / html_table_parser_python3-0.1.3-py3-none-any.whl
| Download URL | html_table_parser_python3-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6528bc49abf399320f92a230cbd351fe663f97b74e52095ef7f905feb49bb684
|
|
BLAKE2b-256 checksum How to use checksums |
e367966e5b64c87b275c94dc9e1bb34ca41db926cca534a12d33aa37aa83b3e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
|
Security for html-table-parser-python3 0.1.3
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.