I have the following html:
<p>Um acidente no cruzamento da rua ... </p>
<div id="marca"></div>
<p>Um acidente no cruzamento ......</p>
<div id="marca2"></div>
I'm trying to do this:
def text_view(self):
soup = BeautifulSoup(self.text)
try:
marca1 = BeautifulSoup(self.get_images())
soup.find("div", {"id": "marca"}).replaceWith(marca1)
except:
pass
try:
marca2 = BeautifulSoup(self.get_images())
soup.find("div", {"id": "marca2"}).replaceWith(marca2)
except:
pass
return soup
But it only replaces the first div text. What can it be?