0

次の形式のテキストがあります ampersand lt;div ampersand gt;\n ampersand lt;div ampersand gt; アンパサンドlt;スパンアンパサンドgt;顧客..このテキストをhtmlに変換するにはどうすればよいですか

<div>
<div>
<span>
Customer..
4

1 に答える 1

1

試す:

import html
html_string = "ampersand lt;div ampersand gt;\n ampersand lt;div ampersand gt; ampersand lt;span ampersand gt;Customer..".replace("ampersand ", "&")
html.unescape(html_string)

新しい行を維持する場合:

html.unescape(html_string.replace("\n", "<br />"))
于 2016-03-03T10:15:12.973 に答える