Hi!
I've written a programme that use BeautifulSoup. It uses urllib to read the HTML from a file, parse the data, extract numbers from the label span and compute the sum of the numbers in the file.
However, it does not work and when I run it it appears:
ModuleNotFoundError: No module named 'html.entities'; 'html' is not a package
Any ideas what I am doing wrong? My programme:
I've written a programme that use BeautifulSoup. It uses urllib to read the HTML from a file, parse the data, extract numbers from the label span and compute the sum of the numbers in the file.
However, it does not work and when I run it it appears:
ModuleNotFoundError: No module named 'html.entities'; 'html' is not a package
Any ideas what I am doing wrong? My programme:
from urllib.request import urlopen from bs4 import BeautifulSoup url = input('Enter - ') archivo = urlopen(url, context=ctx).read() soup = BeautifulSoup(archivo, "archivo.parser") suma=0 tags = soup('span') for tag in tags: suma = suma+int(tag.contents[0]) print(suma)
Larz60+ write Dec-26-2021, 01:12 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed ffor you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed ffor you this time. Please use bbcode tags on future posts.