Search code examples
pythonhtmlbeautifulsouphtml-parser

Want to add some line at particular location in html code


I want to add some line of code in html code at some particular location. I want to know which library will be more helpful BeautifulSoup or html parser? I just to want to add a new line and then write a line of code there. Please help out. I need recommendation to automate a simple process.


Solution

  • I assume what you are referring to is adding a html element/tag to some html.

    Beautiful soup can do what you need relatively simply.

    Overview of how in this thread.

    How can I insert a new tag into a BeautifulSoup object?