BeautifulSoup - getting value from the resultant tags
Question: The below code is my python code with beautiful soup for getting a specified
value from a given URL.

    
    
    from bs4 import BeautifulSoup
    import urllib
    import re
    
    book = urllib.urlopen(url)
    bookpage = book.read()
    book.close()            
    booksoup=BeautifulSoup(bookpage)
    bookTags=booksoup.findAll('div',{"class":"hotel_large_photp_score featured_review_score"})
    print bookTags
    

and when I print the `bookTags` this is what I got (below)

    
    
    <div class="hotel_large_photp_score featured_review_score">
    <a class="big_review_score_detailed js-big_review_score_detailed ind_rev_total hp_review_score" data-component="track" data-hash="cPWbOTCcdSdCBYSbfYCWXT" data-stage="1" data-tab-link="" data-track="click" href="#blockdisplay4" onclick="return false;" rel="reviews" style="">
    <span data-component="track" data-hash="cPWbOTCcdSdCBYSbfYCWXT" data-stage="5" data-track="click">
    <span class=" ">
    Very good
    </span>
    <span class="rating">
    <span class="average">8.2</span><span class="out_of">/<span class="best">10</span></span>
    </span>
    </span>
    </a>
    <span class="trackit score_from_number_of_reviews">
    Score from <strong class="count">229</strong> reviews
    </span>
    

What I need is the value `8.2` from the tag `<span
class="average">8.2</span>`. Please help me to get that value


Answer: Try

    
    
    average = bookTags.find("span", {"class": "average"})
    print average.text
    

