(Jul-01-2021, 04:11 AM)jacklee26 Wrote: t still not add checkbox in front of the link, only the first one.Ok i thought that your input was on new line,see now that input is one big line.
If you make this file could probably fix it when save it,and also save it as utf-8.
Then it will like this.
with open(r'test.html', encoding='utf-8') as f, open('out.html', 'w', encoding='utf-8') as f_out: content = f.read().split('<br>') for line in content[:-1]: #print(f'<input type="checkbox"> {line}') f_out.write(f'<input type="checkbox"> {line}\n')
Output:<input type="checkbox"> <a href="https://www.google.com">Link </a>
<input type="checkbox"> <a href="https://www.youtube.com">Link </a>
<input type="checkbox"> <a href="https://www.instagram.com">Link </a>
With <ul>
tag as i talked about.with open(r'test.html', encoding='utf-8') as f, open('out.html', 'w', encoding='utf-8') as f_out: content = f.read().split('<br>') f_out.write(f'<ul id="links">\n') for line in content[:-1]: f_out.write(f'<input type="checkbox"> {line}\n') f_out.write(f'</ul>\n')CSS CodePen