May-25-2017, 08:17 PM
(May-25-2017, 08:05 PM)snippsat Wrote: You could replace\n
with<br>
,
but better making it a html list bye add<li>
.
lst.txt:
Output:<a href="https://python-forum.io">The best Python forum</a> <a href="https://python-forum.io">The best Python forum</a>with open('lst.txt') as f,open('link.html', 'w') as f_out: for link in f: link = link.strip() make_list = '<li>{}</li>'.format(link) f_out.write('{}\n'.format(make_list))link.html:
Output:<li><a href="https://python-forum.io">The best Python forum</a></li> <li><a href="https://python-forum.io">The best Python forum</a></li>
This works great. (I tried the list feature of html). Thank you.