import bs4 html = """<div class="someClass"> <a href="href"> <img alt="some" src="some"/> </a> </div>""" soup = bs4.BeautifulSoup(html, "html.parser") # this will return src attrib from img tag that is inside 'a' tag soup.a.img['src'] >>> 'some' # if you have more then one 'a' tag for a in soup.find_all('a'): if a.img: print(a.img['src']) >>> 'some'