beautiful soup getting tag.id

You can access tag’s attributes by treating the tag like a dictionary (documentation):

for tag in soup.find_all(class_="bookmark blurb group") :
    print tag.get('id')

The reason tag.id didn’t work is that it is equivalent to tag.find('id'), which results into None since there is no id tag found (documentation).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)