我有一个 HTML 编码的字符串:
'''<img class="size-medium wp-image-113"\
style="margin-left: 15px;" title="su1"\
src="http://blah.org/wp-content/uploads/2008/10/su1-300x194.jpg"\
alt="" width="300" height="194" />'''
我想把它改成:
<img class="size-medium wp-image-113" style="margin-left: 15px;"
title="su1" src="http://blah.org/wp-content/uploads/2008/10/su1-300x194.jpg"
alt="" width="300" height="194" />
我希望它注册为 HTML,这样浏览器就可以将其呈现为图像,而不是显示为文本。
字符串是这样存储的,因为我使用的是一个名为 BeautifulSoup
的网页抓取工具,它“扫描”一个网页,并从中获取某些内容,然后以该格式返回字符串。
我已经找到了如何做到这一点在 C # 但不在 巨蟒。有人可以帮助我吗?