This is what I know how to write and save it
Html_file= open\"(filename\",\"w\")
Html_file.write()
Html_file.close
But how do I save to the
You can also do this without having to call close() using the with keyword. For example:
# HTML String
html = """
Number
Square
<% for i in range(10): %>
<%= i %>
<%= i**2 %>
"""
# Write HTML String to file.html
with open("file.html", "w") as file:
file.write(html)
See https://stackoverflow.com/a/11783672/2206251 for more details on the with keyword in Python.