for all div in soup.findAll(attrs={'class':'image-caption'}): for br in div.findAll('br'): br.extract()