Lange Rede, kurzer Sinn, ich versuche Beautiful Soup zu verwenden, um b Tags durch starke Tags zu ersetzen. Suppe nimmt eine Eingabe, dieSchöne Suppe find_all wrappt zusammen statt einzeln
<b>Words:</b> attributes
<b>Other Words:</b> other attributes
ich habe folgende python3 Code enthält:
strong_tag = soup.new_tag("strong")
if(soup.find('b')):
for b_tag in soup.find_all('b'):
b_tag.wrap(strong_tag)
Diese gibt
attributes
<strong><b>Words:</b><b>Other Words:</b></strong> other attributes
statt
<strong><b>Words:</b></strong> attributes
<strong><b>Other Words:</b></strong> other attributes
Wie kann ich repariere das?
Ich gehe davon aus, dass sobald ich das beheben kann, ich extrahiere() den Inhalt von den b-Tags, nur die starken Tags zurücklassen.