python How can I parse html and print specific output inside html tag
Question: 
    #!/usr/bin/env python    
    import requests, bs4
    
        res = requests.get('https://betaunityapi.webrootcloudav.com/Docs/APIDoc/APIReference')
        web_page = bs4.BeautifulSoup(res.text, "lxml")
    
        for d in web_page.findAll("div",{"class":"actionColumnText"}):
            print d
    

Result:

    
    
    <div class="actionColumnText">
    <a href="/Docs/APIDoc/Api/POST-api-console-gsm-gsmKey-sites-siteId-endpoints-reactivate">/service/api/console/gsm/{gsmKey}/sites/{siteId}/endpoints/reactivate</a>
    </div>
    <div class="actionColumnText">
    Reactivates a list of endpoints, or all endpoints on a site.        </div>
    

I am interested to see output with only the last line (_Reactivates a list of
endpoints, or all endpoints on a site_) removing start and end . Not
interested in the line with _href_

Any help is greatly appreciated.


Answer: In a simple case, you can just [get the
text](https://www.crummy.com/software/BeautifulSoup/bs4/doc/#get-text):

    
    
    for d in web_page.find_all("div", {"class": "actionColumnText"}):
        print(d.get_text())
    

Or/and, if there is only single element you want to find, you can get the last
match by index:

    
    
    d = web_page.find_all("div", {"class": "actionColumnText"})[-1]
    print(d.get_text())
    

Or, you can also find `div` elements with a specific class which don't have an
`a` child element:

    
    
    def filter_divs(elm):
        return elm and elm.name == "div" and "actionColumnText" in elm.attrs and elm.a is None 
    
    for d in web_page.find_all(fitler_divs):
        print(d.get_text())
    

Or, in case of a single element:

    
    
    web_page.find(fitler_divs).get_text()
    

