Insert new line after each "<div>"

Viewed 27

I have a document full of html divs, i want to style it. I want a programm that inserts a new line after each element.

I would prefer handling this in python.

1 Answers

You can probably create a script that searches for those elements in file, and adds
tag after them.

Something like this:

with open('asdf.html') as file:
   line = file.read()
   if '</div>' in line:
      file.write('<br>')
       
Related