I have a folder full of html files as follows:
aaa.html
bbb.html
ccc.html
....
......
.........
zzz.html
All these htmls are created using a python script, and hence follow the same template.
Now, I want to link all these html files, for which I already have the placeholders in the html as follows:
<nav>
<ul class="pager">
<li class="previous"><a href="#">Previous</a></li>
<li class="next"><a href="#">Next</a></li>
</ul>
</nav>
I want to fill these placeholders with the filenames in the folder. For example, bbb.html
will have
<nav>
<ul class="pager">
<li class="previous"><a href="aaa.html">Previous</a></li>
<li class="next"><a href="ccc.html">Next</a></li>
</ul>
</nav>
and the ccc.html
file will contain:
<nav>
<ul class="pager">
<li class="previous"><a href="bbb.html">Previous</a></li>
<li class="next"><a href="ddd.html">Next</a></li>
</ul>
</nav>
And so on for rest of the files. Can this task be done using python? I don't even know how to start with. Any hints, suggestions would be really helpful.