How to insert an attribute using BeautifulSoup?
For example, insert the border = "1" attribute as the tag attribute.
EDIT:
I answered my question (for a specific class of the table even):
inTopic = urllib2.urlopen ("file: /// C: /test/test.html") content = BeautifulSoup (inTopic)
tlist = content.findAll ('table', "myTableClass") for tbl in tlist: tbl ['border'] = "1" print tbl.attrs
source
share