This code analyzes all the image forms in the web page <img>, After analysis, add corresponding decoration labels before and after it , And add a hyperlink to the picture .
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></span>''',result)