f = open("output/result.html",'rb') html_content = f.read() f.close() f = open("output/assets/style.css",'rb') css_content = f.read() f.close() # soup = BeautifulSoup(data, "html.parser") # bb = soup.find_all("b") # print(bb) # for b in bb: # b.replace_with("'''%s'''" % b.text) # print(soup.prettify()) soup = BeautifulSoup(html_content, "html.parser") stylesheets = soup.findAll("link", {"rel": "stylesheet"}) for s in stylesheets: s.replace_with('') print(soup.prettify()) open("output.html", "w").write(str(soup))