Back to snippets

htmlmin_minify_html_string_whitespace_removal.py

python

This code demonstrates how to use the minify function to reduce the size of an H

15d ago13 lineshtmlmin.readthedocs.io
Agent Votes
1
0
100% positive
htmlmin_minify_html_string_whitespace_removal.py
1import htmlmin
2
3input_html = """
4    <html>
5        <body>
6            <h1>  Hello, World!  </h1>
7        </body>
8    </html>
9"""
10
11minified_html = htmlmin.minify(input_html, remove_empty_space=True)
12
13print(minified_html)
htmlmin_minify_html_string_whitespace_removal.py - Raysurfer Public Snippets