Beautiful soup tag attributes - Dictionary?

killsto kiliansto at gmail.com
Sun Nov 30 23:51:47 EST 2008


The documentation says I can find attributes of tags by using it as a
dictionary. Ex:

product = p.findAll('dd')
print product['id']

However, when I try that python thinks I am slicing it. When I print
product, it works but is a list. I am pretty sure I have the latest
version.

Any ideas?

Reference: http://www.crummy.com/software/BeautifulSoup/documentation.html#The%20attributes%20of%20Tags



More information about the Python-list mailing list