I try to use beautifulsoup to parse html, but whenever I click on a page using the built-in script tag, beautifulsoup encodes the content but does not decode it at the end.
This is the code I'm using:
from bs4 import BeautifulSoup if __name__ == '__main__': htmlData = '<html> <head> <script type="text/javascript"> console.log("< < not able to write these & also these >> "); </script> </head> <body> <div> start of div </div> </body> </html>' soup = BeautifulSoup(htmlData) #... using BeautifulSoup ... print(soup.prettify() )
I want this output:
<html> <head> <script type="text/javascript"> console.log("< < not able to write these & also these >> "); </script> </head> <body> <div> start of div </div> </body> </html>
But I get this output:
<html> <head> <script type="text/javascript"> console.log("< < not able to write these & also these >> "); </script> </head> <body> <div> start of div </div> </body> </html>
source share