Jan-04-2018, 11:40 AM
from bs4 import BeautifulSoup html = '''\ <table style=" border-collapse: collapse;" border="0" cellPadding="0" summary="Transactions statistics summary table" class="750WidthClass"> <tr bgcolor="330066"> <td id="LraTransaction Name " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Transaction Name </span></td> <td id="Status" class="table_header" vAlign="top" width="80"><span class="Verdana2">SLA Status</span></td> <td id="LraMinimum " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Minimum </span></td> <td id="LraAverage " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Average </span></td> <td id="LraMaximum " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Maximum </span></td> <td id="LraStd. Deviation " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Std. Deviation </span></td> <td id="Lra80 Percent " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">80 Percent </span></td> <td id="LraPass " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Pass </span></td> <td id="LraFail " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Fail </span></td> <td id="LraStop " class="table_header_for_html_report" vAlign="top"><span class="Verdana2">Stop </span></td> </tr> </table>''' soup = BeautifulSoup(html, 'lxml') table = soup.find(class_="750WidthClass") verdana = table.select('.Verdana2') for item in verdana: print(item.text)
Output:Transaction Name
SLA Status
Minimum
Average
Maximum
Std. Deviation
80 Percent
Pass
Fail
Stop