[Python] tabelle htm a csv

Marco Mariani marco.mariani a prometeia.it
Lun 22 Feb 2010 13:53:00 CET


On 02/19/2010 10:55 AM, ivan marchesini wrote:

> quello che mi manca è proprio capire come posso prnedere il dato
> (urllib.urlopen??) e poi "sezionarlo" per ottenere una matrice da
> esportare in csv..
>   

Con ulropen tiri fuori l'HTML

poi lo passi a lxml.html.fromstring

cerchi l'elemento TABLE, e infine

table_elements = list(list(td.text for td in tr.iterchildren()) for tr
in table.iterchildren())


o qualcosa di simile.

-- 
This e-mail (and any attachment(s)) is strictly confidential and for use only by intended recipient(s). Any use, distribution, reproduction or disclosure by any other person is strictly prohibited. The content of this e-mail does not constitute a commitment by the Company except where provided for in a written agreement between this e-mail addressee and the Company. If you are not an intended recipient(s), please notify the sender promptly and destroy this message and its attachments without reading or saving it in any manner. Any non authorized use of the content of this message constitutes a violation of the obligation to abstain from learning of the correspondence among other subjects, except for more serious offence, and exposes the person responsible to the relevant consequences.



Maggiori informazioni sulla lista Python