Python 3 html module import error?

Question:

I am using python 3.5….One of the dependency file I am using has this line

import html

The file is also coded in python.
So I get this error:

import html ImportError: No module named html

So I tried

sudo apt-get install html

And it gives me this error

E: Unable to locate package html

Asked By: Azazel

||

Answers:

To install html module try this:

pip install html

To import html module in python :

from html import HTML
h = HTML()

For better understanding here is an example :

h.p('Hello, world!')
print h 

I hope it works.

Answered By: Masud Rumii

This happens when you run .py scripts for version 3 with the python.exe version 2. I my case, running python from any directory would always start up version 3, however, windows file associations for .py extension were made for the older python directory.

Answered By: Davorin Mestric
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.