I have a file with bunch of lines and I want add html tag for in every line in file
Example:
1. [url]www.google.com[/url]
2. [url]www.facebook.com[/url]
....
107. [url]www.daniweb.com[/url]
and the result I want in the end: <p>1: <a href="www.google.com" target="blank">www.google.com</a></p>
..so I have 180 lines in the file and want all of lines have the tags as above
My python code for now:
#open file first
fobj = open("C:/Users/Ihsan/Desktop/links.txt", 'r+')
data_list = fobj.readlines() #import into working environment
init, head, tail, end = "<p>", "<a href=\"", "\" target=\"blank\">", "</a></p>"
for i in data_list: #call every item
for link in i:
begin = link.index("w") #know the first "h" index
.....
so how to modify items in list?