html we use select('#author'to return list of all the elements with id="authorwe store this list of tag objects in the variable elemsand len(elemstells us there is one tag object in the listthere was one match calling gettext(on the element returns the element' textor inner html the text of an element is the content between the opening and closing tagsin this case'al sweigartpassing the element to str(returns string with the starting and closing tags and the element' text finallyattrs gives us dictionary with the element' attribute'id'and the value of the id attribute'authoryou can also pull all the elements from the beautifulsoup object enter this into the interactive shellpelems examplesoup select(' 'str(pelems[ ]'download my python book from my website pelems[ gettext('download my python book from my website str(pelems[ ]'learn python the easy way!pelems[ gettext('learn python the easy way!str(pelems[ ]'by al sweigartpelems[ gettext('by al sweigartthis timeselect(gives us list of three matcheswhich we store in pelems using str(on pelems[ ]pelems[ ]and pelems[ shows you each element as stringand using gettext(on each element shows you its text getting data from an element' attributes the get(method for tag objects makes it simple to access attribute values from an element the method is passed string of an attribute name and returns that attribute' value using example htmlenter the following into the interactive shellimport bs soup bs beautifulsoup(open('example html')'html parser'spanelem soup select('span')[ str(spanelem'al sweigartspanelem get('id''authorspanelem get('some_nonexistent_addr'=none true spanelem attrs {'id''author'