Tag là từ điển

soup = BeautifulSoup('<b class="boldest">Extremely bold</b>', 'html.parser')
tag = soup.b
type(tag)
# <class 'bs4.element.Tag'>

tag = BeautifulSoup('<b id="boldest">bold</b>', 'html.parser').b
tag['id']
# 'boldest'

Nguồn:: Beautiful Soup Documentation — Beautiful Soup 4.12.0 documentation
Những vật thể đơn giản dùng để tra cứu dữ liệu theo từ khoá gọi là từ điển


Cập nhật lần cuối : 30 tháng 6, 2024
Tạo : 17 tháng 12, 2023