0

I am a newb to Python and can't figure this out. I have a html string stored as myHtmlString, but get error: unicode argument expected, got 'str'. I am trying to minify the html string and remove extra spaces.

import htmlmin

myHtmlString ="""<body   style="background-color: tomato;">
                <h1>  htmlmin   rocks</h1>
                 <pre>
                    and rolls
                 </pre>
                 </body>"""

myHtmlString2  = htmlmin.minify(myHtmlString, remove_empty_space=True)

1 Answers1

0

Got it:

myHtmlString2  = htmlmin.minify(unicode(myHtmlString, "utf-8"), remove_empty_space=True)