RES: Parseador HTML en Python

Denstone, Alexandre J ajdenstone en bkb.com.br
Mar Jul 4 18:57:58 CEST 2006


Has probado ElementTree?

http://effbot.org/zone/element-index.htm

Alexandre J Denstone
ajdenstone en bkb.com.br 

-----Mensagem original-----
De: python-es-bounces en aditel.org [mailto:python-es-bounces en aditel.org] Em nome de Mikel Larreategi
Enviada em: terça-feira, 4 de julho de 2006 05:38
Para: La lista de python en castellano
Assunto: Re: [Python-es] Parseador HTML en Python

Cesar Ortiz(e)k dio:
> Una opción que yo he usado es tidy + HTMLParser. Pero es mas recomendable
> como ya te han indicado un parser menos estricto.
> Beautiful Soup no lo he probado, pero si libxml2. Libxml2 (está escrito en
> C) en su propia distribución tiene bindings para python:
> http://xmlsoft.org/python.html.
> Otro binding para libxml2 es: http://codespeak.net/lxml/.

lxml incorpora también un parser para HTML (es el de libxml2):

>>> from lxml import etree
>>> from urllib2 import urlopen
>>> sock = urlopen('http://www.google.com/')
>>> doc = etree.HTML(sock.read())
>>> etree.tostring(doc)
'<html><head><meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1"/><title>Google</title>
(...)


Más documentación:
http://codespeak.net/svn/lxml/trunk/doc/api.txt


Saludos,


-- 
Mikel Larreategi
mlarreategi en codesyntax.com

CodeSyntax
Azitaingo Industrialdea 3 K
E-20600 Eibar
Tel: (+34) 943 82 17 80
_______________________________________________
Python-es mailing list
Python-es en aditel.org
http://listas.aditel.org/listinfo/python-es


Esta mensagem, incluindo seus anexos, pode conter informação confidencial e/ou privilegiada. Se você recebeu este e-mail por engano, não utilize, copie ou divulgue as informações nele contidas. E, por favor, avise imediatamente o remetente, respondendo ao e-mail, e em seguida apague-o. Este e-mail possui conteúdo informativo e não transacional. Caso necessite de atendimento imediato, recomendamos utilizar um dos canais disponíveis: Internet Banking <http://www.bankboston.com.br> , BankBoston por telefone <http://www.bankboston.com.br/bpt> ou agência/representante de atendimento de sua conveniência. Agradecemos sua colaboração.
This message, including its attachments, may contain confidential and/or privileged information. If you received this email by mistake, do not use, copy or disseminate any information herein contained. Please notify us immediately by replying to the sender and then delete it. This email is for information purposes only, not for transactions. In case you need immediate assistance, please use one of the following channels: Internet Banking <http://www.bankboston.com.br> , BankBoston by phone <http://www.bankboston.com.br/bpt> or branch/relationship manager at your convenience. Thank you for your cooperation.




Más información sobre la lista de distribución Python-es