fork download
  1. import re
  2.  
  3. html_doc = ("<section id=\"box3\" class=\"nodisp_zero\" style=\"display: none;\">\n"
  4. " <h1 id=\"box_ttl3\" style=\"display: none;\"></h1>\n"
  5. " <img style=\"width: 100%; display: none;\" id=\"box_img3\" alt=\"box3\" src=\"https://s...content-available-to-author-only...s.jp/s/topics/img/dummy.png\" class=\"lazy\" data-original=\"https://s...content-available-to-author-only...s.jp/s/topics/img/201808/201808220015_box_img3_A.jpg?1533975785\">\n"
  6. " <figcaption id=\"box_caption3\" style=\"display: none;\"></figcaption>\n"
  7. " <div class=\"textarea clearfix\">\n"
  8. " <h2 id=\"box_subttl3\" style=\"display: none;\"></h2>\n"
  9. " <div class=\"fontL\" id=\"box_com3\" style=\"display: none;\"></div>\n"
  10. " </div>\n"
  11. "</section>")
  12.  
  13. # You can manually specify the number of replacements by changing the 4th argument
  14. html_doc = re.sub(r"display:\s*none;?", "", html_doc, 0)
  15.  
  16. print(str(html_doc))
Success #stdin #stdout 0.04s 27712KB
stdin
Standard input is empty
stdout
<section id="box3" class="nodisp_zero" style="">
    <h1 id="box_ttl3" style=""></h1>
    <img style="width: 100%; " id="box_img3" alt="box3" src="https://s...content-available-to-author-only...s.jp/s/topics/img/dummy.png" class="lazy" data-original="https://s...content-available-to-author-only...s.jp/s/topics/img/201808/201808220015_box_img3_A.jpg?1533975785">
    <figcaption id="box_caption3" style=""></figcaption>
    <div class="textarea clearfix">
        <h2 id="box_subttl3" style=""></h2>
        <div class="fontL" id="box_com3" style=""></div>
    </div>
</section>