Jul-25-2019, 10:02 AM
Do anyone know how to read a file, and write into html with the correct link page.
i have a file name test.txt, which contain:
www.google.com
www.cnn.com
If i write as below, it will not link to correct link page. Do anyone know why? What shall i correct, if i want to link correct place.
i also try with this
i have a file name test.txt, which contain:
www.google.com
www.cnn.com
If i write as below, it will not link to correct link page. Do anyone know why? What shall i correct, if i want to link correct place.
with open('test.txt') as f,open('out.html', 'w') as f_out: for line in f: line = line.strip() #print("<a href=",line ,"</a>","link") #print (line1) f_out.write('{}<br>'.format('<a href="line">Link </a>')) hyperlink_format = '<a href="{link}">{text}</a>'How to i let it display on html which will have this two link.
i also try with this
f_out.write('{}<br>'.format('<a href="+line+">Link </a>'))same