new way to integrate vacciation data into website: have separate head and foot file and regenerate index every day
This commit is contained in:
@@ -149,11 +149,17 @@ def plot(data, countries, pop, **kwargs):
|
||||
print(f"=====> plotting failed for {loc}, skipping plot. Error: {e}")
|
||||
|
||||
## vaccination overview html
|
||||
with open("vac_state.html", "w") as f:
|
||||
# header
|
||||
with open("index.html", "w") as f:
|
||||
# site header
|
||||
with open("index.html.head", "r") as g:
|
||||
f.write(g.read())
|
||||
# table header
|
||||
f.write("<table><tr><th>Land</th><th>Impfungen</th><th>Impfrate</th></tr>\n")
|
||||
# data
|
||||
for loc, tvac, rvac in vaccs:
|
||||
f.write(f"<tr><td>{loc}</td><td>" + f"{tvac:,d}".replace(",",".") + f"</td><td>{rvac:3.3f}%</td></tr>\n".replace(".", ","))
|
||||
# footer
|
||||
# table footer
|
||||
f.write("</table>\n")
|
||||
# site footer
|
||||
with open("index.html.foot", "r") as g:
|
||||
f.write(g.read())
|
||||
|
||||
Reference in New Issue
Block a user