79668393

Date: 2025-06-17 01:59:18
Score: 1
Natty:
Report link

I used Beautiful Soup https://www.crummy.com/software/BeautifulSoup/bs4/doc/
I'm doing a Python course, if I'm wrong, sorry (I'm learning)

# pip install beautifulsoup4 
# import beautifulsoup4
from bs4 import BeautifulSoup

# Read the contents of the HTML file
with open("./website.html") as file:
    contents = file.read()
    
# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(contents, "html.parser")
print(soup) # print the entire HTML document

# Print the title of the HTML document
print(soup.title)  # <title>My Website</title>
print(soup.title.string)  # My Website
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Rafael Menchaca