zoukankan      html  css  js  c++  java
  • python去除指定的html标签和css样式

    import re
    from w3lib import html
    
    
    def parse_tags():
        # 去除样式
        # link_re = re.compile(r'<a.*?>')
        p_re = re.compile(r'<p.*?>')
        # span_re = re.compile(r'<span.*?>')
        # font_re = re.compile(r'<font.*?>')
        tb_re = re.compile(r'<table.*?>')
        tr_re = re.compile(r'<tr.*?>')
        td_re = re.compile(r'<td.*?>')
        html_str = '''<p><span style="text-indent: 2em;" data-mce-style="text-indent: 2em;"> </span></p><div id="zy_body"><div class="cont-cont"><table style="border: 1px solid #000000; text-align: center; border-collapse: collapse;  90%;" cellspacing="0" cellpadding="0" align="center" data-mce-style="border: 1px solid #000000; text-align: center; border-collapse: collapse;  90%;" class="mceItemTable"><tbody><tr class="firstRow" style="background-color: #d9d9d9;" data-mce-style="background-color: #d9d9d9;"><td style="border: 1px solid #000000;" width="71" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">product</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Terms</font></font></span></p></td><td style="border: 1px solid #000000;" width="100" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">2021/10/13</font></font></span></p></td><td style="border: 1px solid #000000;" width="83" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Quote change</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">unit</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Remark</font></font></span></p></td></tr><tr style=";height: 23px;" data-mce-style=";height: 23px;"><td style="border: 1px solid #000000;" width="71" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">crude</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">11 </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Yue</font></font></span></p></td><td style="border: 1px solid #000000;" width="100" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">80.44</font></font></span></p></td><td style="border: 1px solid #000000;" width="83" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-0.2</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/barrel</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">WTI</font></font></span></p></td></tr><tr style=";height: 35px;" data-mce-style=";height: 35px;"><td style="border: 1px solid #000000;" width="71" height="35" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">crude</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="35" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">12 </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Yue</font></font></span></p></td><td style="border: 1px solid #000000;" width="100" height="35" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">83.18</font></font></span></p></td><td style="border: 1px solid #000000;" width="83" height="35" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-0.24</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="35" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/barrel</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="35" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Brent</font></font></span></p></td></tr><tr style=";height: 6px;" data-mce-style=";height: 6px;"><td style="border: 1px solid #000000;" width="71" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Naphtha</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">November </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">up/December down</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="100" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">767.38</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-4.88</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">CFR </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Japan</font></font></span></p></td></tr><tr style=";height: 45px;" data-mce-style=";height: 45px;"><td style="border: 1px solid #000000;" width="71" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">MX </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">America</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="45" data-mce-style="border: 1px solid #000000;"> </td><td style="border: 1px solid #000000;" valign="top" width="100" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">890.72</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">0.00</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">FOB US</font></font></span></p></td></tr><tr style=";height: 45px;" data-mce-style=";height: 45px;"><td style="border: 1px solid #000000;" width="71" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">MX </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Asia</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">11 </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">months under / on Nov.</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="100" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">836.00</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-7.00</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">CFR </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Taiwan LC 30 days</font></font></span></p></td></tr><tr style=";height: 23px;" data-mce-style=";height: 23px;"><td style="border: 1px solid #000000;" width="71" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">PX </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">America</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="23" data-mce-style="border: 1px solid #000000;"> </td><td style="border: 1px solid #000000;" valign="top" width="100" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">981.50</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-5.00</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="23" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">FOB US</font></font></span></p></td></tr><tr style=";height: 6px;" data-mce-style=";height: 6px;"><td style="border: 1px solid #000000;" width="71" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">PX </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Asia</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">11 </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">months under / on Nov.</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="100" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">931.25</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-6.75</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="6" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">CFR </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Taiwan/China LC30-45 days</font></font></span></p></td></tr><tr style=";height: 45px;" data-mce-style=";height: 45px;"><td style="border: 1px solid #000000;" width="71" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">PTA</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="45" data-mce-style="border: 1px solid #000000;"> </td><td style="border: 1px solid #000000;" valign="top" width="100" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">735.00</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-15.00</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">CFR </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">China LC90 days</font></font></span></p></td></tr><tr style=";height: 45px;" data-mce-style=";height: 45px;"><td style="border: 1px solid #000000;" width="71" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">MEG</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="45" data-mce-style="border: 1px solid #000000;"> </td><td style="border: 1px solid #000000;" valign="top" width="100" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">855.00</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">-50.00</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">CFR </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">China LC90 days</font></font></span></p></td></tr><tr style=";height: 45px;" data-mce-style=";height: 45px;"><td style="border: 1px solid #000000;" width="71" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">PET</font></font></span></p></td><td style="border: 1px solid #000000;" width="88" height="45" data-mce-style="border: 1px solid #000000;"> </td><td style="border: 1px solid #000000;" valign="top" width="100" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">1090.00</font></font></span></p></td><td style="border: 1px solid #000000;" valign="top" width="83" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="line-height: 115%;" data-mce-style="line-height: 115%;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">100.00</font></font></span></p></td><td style="border: 1px solid #000000;" width="51" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">USD/ton</font></font></span></p></td><td style="border: 1px solid #000000;" width="143" height="45" data-mce-style="border: 1px solid #000000;"><p><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">FOB </font></font></span><span style="color: black;" data-mce-style="color: black;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;"><font style="vertical-align: inherit;" data-mce-style="vertical-align: inherit;">Northeast Asia LC 90 days</font></font></span></p></td></tr></tbody></table><p style="line-height: 1.5em;" data-mce-style="line-height: 1.5em;"> </p><br><br><br></div></div>'''
        # 去除指定的html标签
        table = html.remove_tags(
            html_str, ("div", "font", "span"), encoding="utf-8")
    
        table = re.sub(p_re, '<p>', table)
        table = re.sub(tb_re, '<table>', table)
        table = re.sub(tr_re, '<tr>', table)
        table = re.sub(td_re, '<td>', table)
        print(table)
    
    
    if __name__ == '__main__':
        parse_tags()
    

      

  • 相关阅读:
    UOS、鸿蒙、麒麟全面出击,国产系统能否干掉Windows?
    黑客给疫情添乱
    人工智能与信息安全
    作为一个程序员,告诉你一些编码知识
    Linus Torvalds 宣布新版Linux系统内核发布
    linux系统root密码忘记了怎么办
    DevOps与NoOps现状分析
    Nginx服务详细介绍
    博客园“可运行"代码
    让setTimeout支持链式
  • 原文地址:https://www.cnblogs.com/fly-kaka/p/15407705.html
Copyright © 2011-2022 走看看