Explain sum(int(td.text) for td in soup.select('td:last-child')[1:])
Explain sum(int(td.text) for td in soup.select('td:last-child')[1:]) Question: I came across this piece of code during solving a problem. I just cannot understand how the last line of the code before the print functions. Please explain. import re import urllib.request from bs4 import BeautifulSoup # url = ‘http://py4e-data.dr-chuck.net/comments_42.html’ url = ‘http://py4e-data.dr-chuck.net/comments_228869.html’ soup = BeautifulSoup(urllib.request.urlopen(url).read(), ‘html.parser’) s …