fork download
  1. from bs4 import BeautifulSoup # To get everything
  2. html = """
  3. <td>Name :</td>, <td>xyz</td>,
  4. <td>Mobile :</td>, <td>180-14587962</td>,
  5. <td>Company:</td>, <td>abc Comp</td>,
  6. <td>Name :</td>, <td> </td>,
  7. <td>Mobile :</td>, <td> </td>,
  8. <td>Company:</td>, <td> </td>,
  9. <td>Name :</td>, <td> </td>,
  10. <td>Mobile :</td>, <td> </td>
  11. """
  12.  
  13. #print html
  14.  
  15. soup = BeautifulSoup(html, "lxml")
  16. x = soup.find_all("td") #OK
  17. print x[1]
  18. print x[3]
Success #stdin #stdout 0.26s 50224KB
stdin
Standard input is empty
stdout
<td>xyz</td>
<td>180-14587962</td>