Skip to content

Instantly share code, notes, and snippets.

@jml
Created December 16, 2013 01:04
Show Gist options
  • Select an option

  • Save jml/7980881 to your computer and use it in GitHub Desktop.

Select an option

Save jml/7980881 to your computer and use it in GitHub Desktop.
import csv
def make_link(url, text):
if not url:
return ' '
return '<a href="%s">%s</a>' % (url, text)
def td(text):
return '<td>%s</td>' % (text,)
def tr(text):
return '<tr>%s</tr>' % (text,)
def table_row(cells):
return tr(''.join(map(td, cells)))
def format_row(date, word, bice_link, jml_link):
return table_row(
[date,
make_link(bice_link, word),
make_link(jml_link, word),
])
with open('as-summary.csv') as raw_file:
reader = csv.reader(raw_file)
for row in reader:
[date, word, bice_link, jml_link] = row
print format_row(date, word, bice_link, jml_link)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment