简体   繁体   中英

Insert new line after each "<div>"

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.

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>')
       

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM