ウェブサイトのタイトルを取得する(Python&BeautifulSoup)

Colaboratory の使い方はこちら

import requests
from bs4 import BeautifulSoup

# 対象のURL
url = "https://blog.apiless.com/2023/01/03/colaboratory/"

html = requests.get(url)
soup = BeautifulSoup(html.content, "html.parser")
title = soup.find('title').text

print(title)

結果としてタイトルが表示されます