Last active
September 28, 2024 17:09
Create HTML File in Python. For more details: https://kb.aspose.com/html/python/create-html-file-in-python/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.html | |
import os | |
from aspose.html import * | |
path = "C://" | |
document_path = os.path.join(path, "document.html") | |
# Initialize an empty HTML document | |
with HTMLDocument() as document: | |
# Create a text node | |
text = document.create_text_node("Hello, World!") | |
document.body.append_child(text) | |
# Save the document to a file | |
document.save(document_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment