January 2014
Beginner
130 pages
2h 37m
English
The Tag object represents different tags of HTML and XML documents. The creation of Tag objects is done when parsing the documents. The different HTML/XML tags identified during parsing are represented as corresponding Tag objects and these objects will have attributes and contents of the HTML/XML tag. The Tag objects can be used for searching and navigation within the HTML/XML document.
BeautifulSoup allows us to access any Tag object. For example, we can access the first occurrence of the <a> tag in the next example by simply calling the name of the tag <a>.
html_atag = """<html><body><p>Test html a tag example</p> <a href="http://www.packtpub.com'>Home</a> <a href="http;//www.packtpub.com/books'>Books</a> ...
Read now
Unlock full access