Parse HTML files then edit them in python
So my problem is that I want to have a website that has a single
navbar.html file. That I can use to add to the other pages in my website.
I figured the best way to do this without javascript which I am trying to
avoid because of compatibility issues (school website so I am trying to
get best compatibility). I am writing this website for my school so I
don't know what is going to happen to it from now on but I want to create
an automated system that can parse the folder for html files then go into
each and find the <nav id="mainNav">.....</nav> and then replace all the
content between those two tags with content from one central navbar.html
so that someone can just go in change the navbar.html then run this script
and it would just auto update the webpages.
Now I'm not asking anyone to write the code for me I have a basic to
intermediate understanding of python so if you could point me towards a
tutorial or two or if maybe there is already a program out there that I
haven't found would be great. Thanks for the help.
Edit: I would like to only use standard libraries so that it is as easy as
possible to move around preferably it would be just one *.py file
No comments:
Post a Comment