Extract text only from a webpage through "html.parser"
from bs4 import BeautifulSoup
from urllib.request import urlopen
url = "https://en.wikipedia.org/wiki/Kabul#Toponymy_and_etymology"
page = urlopen(url)
html = page.read().decode("utf-8")
soup = BeautifulSoup(html, "html.parser")
print(soup.get_text())
Comments
Post a Comment
Write something to CodeWithAbdur!