Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created July 16, 2011 05:32
Show Gist options
  • Save yurenju/1086042 to your computer and use it in GitHub Desktop.
Save yurenju/1086042 to your computer and use it in GitHub Desktop.
generate html
csv = open('coscup.csv')
html = open('album.html', 'w')
style = 'width:600px;margin-bottom:50px;';
style += 'margin-left:auto;margin-right:auto;'
style += 'border: 1px solid #AAA;padding:10px;'
style += '-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);'
for line in csv.readlines():
if 'Timestamp' in line:
continue
arr = [n.strip() for n in line.split(',')]
html.write('<div style="%s">' % style);
html.write('<img src="%s" width="600px"/>' % arr[1])
html.write('<div style="text-align:center">%s - %s</div>' % (arr[0], arr[2]))
html.write('</div>')
csv.close()
html.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment