Reputation: 1382
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>\n\n\<p><p>
so basicaly I need to check if \n\n is between <p> and <p><p>
then i have to remove it.
Upvotes: 0
Views: 44
Reputation: 2433
Use string method replace:
s = s.replace("<p>\n\n\</p><p>", "<p></p><p>")
(or whatever you need replacing)
Upvotes: 2