So I have this problem for some reason some times I’m getting a string with two n/ n/ signs between first <p> and <p><p>
, how could try to catch it and remove it?
look like this if I paste it
string = '<p> </p><p><span style="color: rgb(114, 114, 114);text-align: justify">Tutorials</span><br></p><p></p>'
if I look at this string from debugger then I see it like <p>nn<p><p>
so basicaly I need to check if nn is between <p> and <p><p>
then i have to remove it.
Advertisement
Answer
Use string method replace:
s = s.replace("<p>nn</p><p>", "<p></p><p>")
(or whatever you need replacing)