import bs4

html = """<div class="someClass">
    <a href="href">
        <img alt="some" src="some"/>

soup = bs4.BeautifulSoup(html, "html.parser")

# this will return src attrib from img tag that is inside 'a' tag

>>> 'some'

# if you have more then one 'a' tag
for a in soup.find_all('a'):
    if a.img:

>>> 'some'
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter