Skip to content

Instantly share code, notes, and snippets.

@keikoro
Last active November 1, 2016 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keikoro/59a738f850177cd0878834c29f4ee9e5 to your computer and use it in GitHub Desktop.
Save keikoro/59a738f850177cd0878834c29f4ee9e5 to your computer and use it in GitHub Desktop.
Convert a .csv with URLs and URL descriptions to HTML list elements
#!/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