|
|
|
|
Configuration: Windows XP Firefox 2.0.0.13
|
Tu peux effectivement utiliser re.sub, ou bien beautifulsoup (un peu lent, mais marche bien).
Petit exemple de remplacement avec BeautifulSoup (à adapter): import BeautifulSoup
htmlpage = open('mapage.html','rb').read()
soup = BeautifulSoup.BeautifulSoup(htmlpage)
soup.done()
for titre in soup('span',{'class' : ['comptitle','titre']}):
titre.name = 'h1' # Convert span to h1
del titre['class'] # Remove class
|
Résultats pour Python : modifier balise html contenu ds var.
Résultats pour Python : modifier balise html contenu ds var.
Résultats pour Python : modifier balise html contenu ds var.
Résultats pour Python : modifier balise html contenu ds var.