Reputation: 43
<p>
First line of output.<br\>
This is the second line.<br\>
</p>
With bs.find('p').text
I'm getting this output:
First line of output.
This is the second line.
I want to remove <br> tags and I want to get an output like First line of output. This is the second line.
I tried replacing \n
, \r\n
with a space but nothing has changed. How can I solve it?
Upvotes: 2
Views: 1711
Reputation: 353
You can simply run "replace" on the string.
s = "<p>First line of output.<br\>This is the second line.<br\></p>"
s.replace("<br\>", "")
will delete all tags "<br>" and then run replace("\n", "") on the same string
Upvotes: 2