Quote:
Originally Posted by Starson17
item and mydaddy are BeautifulSoup Tag objects. Each Tag object has a specified list of properties. mydaddy is the parent of item. The name of mydaddy is 'div'. mydaddy has an attribute called 'id'. The value of that attribute is 'MainContent'.
You can access a tag's attributes by treating the Tag object as though it were a dictionary. Thus you want:
Code:
if mydaddy['id'] == 'MainContent'
.......
or
Code:
if mydaddy.has_key('id') and mydaddy['id'] == 'MainContent'
.......
|
Thank you for explaining that to me.