[Solved] Python: Get data BeautifulSoup


You should use the bs4.Tag.find_all method or something similar.

soup.find_all(attrs={"face":"arial","font-size":"16px","color":"navy"})

Example:

>>>import bs4 
>>>html=""'<div id="accounts" class="elementoOculto">             <table align="center" border="0" cellspacing=0 width="90%">         <tr><th align="left" colspan=2>                 permisos            </th></tr><tr>     <td colspan=2>         <table width=100% align=center border=0 cellspacing=1>             <tr>                 <th align=center width="20%">cuen</th>                 <th align=center>Mods</th>             </tr>         </table>     </td> </tr> </table> <table align="center" border="0" cellspacing=1 width="90%">     <tr bgcolor="whitesmoke" height="08">         <td align="left" width="20%">             <font face="arial" font-size="16px" color="navy">001970000521</font>         </td>         <td>......   <table align="center" border="0" cellspacing=1 width="90%">         <tr bgcolor="whitesmoke" height="08">             <td align="left" width="20%">                 <font face="arial" font-size="16px" color="navy">001970000521</font>             </td> '''
>>>print bs4.BeautifulSoup(html).find_all(attrs={"face":"arial","font-size":"16px","color":"navy"})
 [<font color="navy" face="arial" font-size="16px">001970000521</font>, <font color="navy" face="arial" font-size="16px">001970000521</font>]

1

solved Python: Get data BeautifulSoup