这段代码分析网页中的所有图片表单<img>,分析后为其前后添加相应的修饰标签,并添加到图片的超级链接。
result = value.replace("[page]","").replace(' ',u' ') p=re.compile(r'''(<img/b[^<>]*?/bsrc[/s/t/r/n]*=[/s/t/r/n]*["']?[/s/t/r/n]*([^/s/t/r/n"'<>]*)[^<>]*?/?[/s/t/r/n]*>)''',re.IGNORECASE) result = p.sub(r'''<span class="openIcon"><em></em><a href="/2">/1</a>''',result)
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/8178.html