Skip to main content

HTML converter tool

Project description

HTML Converter Tool

Support Html to Dict, JSON, Str

Installing

Install and update using pip3:

$ pip3 install html_converter

Python 3 and newer.

Simple Usage

if __name__ == '__main__':
    import pprint
    from html_converter import HtmlToDict

    html_data = '<html><body>test text</body></html>'
    converter = HtmlToDict()
    data = converter.convert(html_data, serialize=False)

    pp = pprint.PrettyPrinter(indent=1)
    pp.pprint(converter.convert(html_data, serialize=False).to_dict())
    [{'attrs': {},
      'inner': [{'attrs': {}, 'inner': [], 'tag': 'body', 'text': 'test text'}],
      'tag': 'html',
      'text': ''}]

    print(converter.convert(html_data, serialize=False).to_json())
    '[{"tag": "html", "attrs": {}, "text": "", "inner": [{"tag": "body", "attrs": {}, "text": "fd", "inner": []}]}]'

    print(converter.convert(html_data).to_str())
    test text

Support

  • Python 3.x

  • Supports all operating systems

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

html_converter-1.0.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

html_converter-1.0.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page