Skip to content Skip to sidebar Skip to footer

Name Error 'html' Not Defined With Beautifulsoup4

My python 3.4.4 code is: import urllib.request from bs4 import BeautifulSoup from html.parser import HTMLParser urls = 'file:///C:/Users/tarunuday/Documents/scrapdata/mech.html' h

Solution 1:

The error is correct, you haven't defined html anywhere. The documentation you link to shows that you should be passing "html.parser" as a string; it doesn't look like you need to import HTMLParser at all.


Solution 2:

In your code html.parser is a string and if you are using python 3 or above, it needs quotes around it.


Post a Comment for "Name Error 'html' Not Defined With Beautifulsoup4"