On Apr 1, 10:13 pm, "Ulysse" <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to extract the data from HTML table. Here is the part of > the HTML source : > """ > <tr> > <td class="tdn" valign="top"> > <input name="x44553130" value="y" > type="checkbox"></td> > <td class="tdn" valign="top" width="30%"> > Sat, 31.03.2007 - 20:24:00</td> > <td class="tdn"> > <a href="http://s2.bitefight.fr/bite/ > bericht.php?q=01bf0ba7258ad976d890379f987d444e&beid=2628033">Vous > avez tendu une embuscade à votre victime !</a></td> > </tr> > <tr> > <td class="tdn" valign="top"> > <input name="x44553032" value="y" > type="checkbox"></td> > <td class="tdn" valign="top" width="30%"> > Sat, 31.03.2007 - 20:14:35</td> > <td class="tdn"> > <a href="http://s2.bitefight.fr/bite/ > bericht.php?q=01bf0ba7258ad976d890379f987d444e&beid=2628007">Vous > avez tendu une embuscade à votre victime !</a></td> > </tr> > <tr> > <td class="tdn" valign="top"> > <input name="x44552991" value="y" > type="checkbox"></td> > <td class="tdn" valign="top" width="30%"> > Sat, 31.03.2007 - 20:11:39</td> > <td class="tdn"> Vous avez bien accompli votre > tâche de Gardien de Cimetière et vous vous > voyez remis votre salaire comme récompense. > Vous recevez 320 > <img src="messages-bite_fichiers/res2.gif" > alt="Or" align="absmiddle" border="0"> > et collectez 3 d'expérience !</td> > </tr> > """ > > I would like to transform this in following thing : > > Date : Sat, 31.03.2007 - 20:24:00 > ContainType : Link > LinkText : Vous avez tendu une embuscade à votre victime ! > LinkURL > :http://s2.bitefight.fr/bite/bericht.php?q=01bf0ba7258ad976d890379f987... > > Date : Sat, 31.03.2007 - 20:14:35 > ContainType : Link > LinkText : Vous avez tendu une embuscade à votre victime ! > LinkURL > :http://s2.bitefight.fr/bite/bericht.php?q=01bf0ba7258ad976d890379f987... > > Date : Sat, 31.03.2007 - 20:14:35 > ContainType : Text > Contain : Vous avez bien accompli votre tâche de Gardien de Cimetière > et vous vous > voyez remis votre salaire comme récompense. > Vous recevez 320 et collectez 3 d'expérience ! > > .... > > Do you know the way to do it ?
You can use Beautiful Soup http://www.crummy.com/software/BeautifulSoup/ see this page to see how you can search for tags, then retrieve the contents http://www.crummy.com/software/BeautifulSoup/documentation.html#Searching%20Within%20the%20Parse%20Tree Cheers -- http://mail.python.org/mailman/listinfo/python-list