beautifulsoup to html file code example Example: soup to html file with open("output1.html", "w") as file: file.write(str(soup))