Created
December 16, 2013 01:04
-
-
Save jml/7980881 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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