Last active
December 23, 2024 23:11
-
-
Save keikoro/59a738f850177cd0878834c29f4ee9e5 to your computer and use it in GitHub Desktop.
Convert a .csv with URLs and URL descriptions to HTML list elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import csv | |
filename = 'inputsheet.csv' | |
delimiter = ',' | |
with open(filename, newline='') as csvfile: | |
reader = csv.reader(csvfile, delimiter=delimiter) | |
next(reader) | |
for item in reader: | |
# assumes that 1st column contains urls, 2nd column descriptions | |
url, text = item | |
print('<li><a href="{}">{}</a></li>'.format(url, text)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment