Reputation: 2642
I have text in the following format ampersand lt;div ampersand gt;\n ampersand lt;div ampersand gt; ampersand lt;span ampersand gt;Customer.. How can i convert this text to html i.e.
<div>
<div>
<span>
Customer..
Upvotes: 0
Views: 651
Reputation: 78564
Try:
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)
In case you are looking to maintain new lines:
html.unescape(html_string.replace("\n", "<br />"))
Upvotes: 1