usr bin python import csv import os import stat import time def table

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!usr/bin/python
import csv
import os
import stat
import time
def table():
url = "http://spreadsheets.google.com/pub?key=phy-HLMk8799lCYy3KAIqZQ&output=csv&gid=0"
file = "rates.csv"
out = []
if (int(time.time()) - os.stat(file)[stat.ST_MTIME]) / 60 >= 5:
os.system("wget -qO \'%s\' \'%s\'" % (file, url))
reader = csv.reader(open(file))
out += [reader.next()]
length = len(out[0])
for row in reader:
out += [row + [""] * (length - len(row))]
return out
if __name__ == '__main__':
for row in table():
print "<tr>"
for column in row:
print "<td>%s</td>" % column
print "</tr>"