selector passed to the select(method will match soup select('div'all elements named soup select('#author'the element with an id attribute of author soup select(notice'all elements that use css class attribute named notice soup select('div span'all elements named that are within an element named soup select('div span'all elements named that are directly within an element named with no other element in between soup select('input[name]'all elements named that have name attribute with any value soup select('input[type="button"]'all elements named that have an attribute named type with value button the various selector patterns can be combined to make sophisticated matches for examplesoup select(' #author'will match any element that has an id attribute of authoras long as it is also inside element instead of writing the selector yourselfyou can also right-click on the element in your browser and select inspect element when the browser' developer console opensright-click on the element' html and select copy css selector to copy the selector string to the clipboard and paste it into your source code the select(method will return list of tag objectswhich is how beautiful soup represents an html element the list will contain one tag object for every match in the beautifulsoup object' html tag values can be passed to the str(function to show the html tags they represent tag values also have an attrs attribute that shows all the html attributes of the tag as dictionary using the example html file from earlierenter the following into the interactive shellimport bs examplefile open('example html'examplesoup bs beautifulsoup(examplefile read()'html parser'elems examplesoup select('#author'type(elemselems is list of tag objects len(elems type(elems[ ]str(elems[ ]the tag object as string 'al sweigartelems[ gettext('al sweigartelems[ attrs {'id''author'web scraping