Edit HTML in Python

High-speed and cross-platform Python library for editing HTML using Python code

Edit HTML using Aspose.Slides

Aspose.Slides for Python via .NET is a powerful Python library used to manipulate and edit presentations, HTML documents, and other files. You can edit an HTML doc by adding a new line of text to it.

Edit HTML in Python

Using Aspose.Slides for Python via .NET , you can add a new line of text to an HTML document with just a few lines of code.

Python code for editing HTML


import aspose.slides as slides

with slides.Presentation() as pres:
    pres.slides.remove_at(0)
    with open("page.html", "rt") as stream:
        data = stream.read()
    pres.slides.add_from_html(data)

    shape = pres.slides[0].shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 10, 10, 100, 50)
    shape.text_frame.text = "New text"

    pres.save("page.html", slides.export.SaveFormat.HTML5)

How to edit HTML in Python

  1. Install Aspose.Slides for Python via .NET. See Installation .

  2. Add the library as a reference in your project.

  3. Create an instance of the Presentation class.

  4. Load the HTML document you want to edit.

  5. Add a new line of text.

  6. Save the changed HTML file.

Edit other files

You can also edit files in other formats