From: Christian Heller Date: Sat, 4 Jul 2020 11:20:31 +0000 (+0200) Subject: Add week day name display. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/blog?a=commitdiff_plain;h=ecc9a92512c854244ce9997b4861666460319308;p=berlin-corona-table Add week day name display. --- diff --git a/enhance_table.py b/enhance_table.py index 4a060a4..ab6ec46 100755 --- a/enhance_table.py +++ b/enhance_table.py @@ -134,6 +134,7 @@ for i in range(len(sorted_dates)): db[district][date]['week_incidence'] = (week_sum / district_pop) * 100000 # Optimized for web browser viewing. +import calendar if output_type == 'html': print(""" @@ -170,7 +171,8 @@ th { text-align: left; vertical-align: bottom; } (translate[district], district)) print('') print('') - print('%s' % date) + weekday = calendar.day_name[datetime.date.fromisoformat(date).weekday()] + print('%s
(%s)' % (date, weekday)) print('') for abbr in ['+', 'Σ', 'Ø', 'i']: print('' % @@ -237,7 +239,8 @@ HTML view: https://plomlompom.com/berlin_corona.html""" print('-'*77) # Day table. - print(date) + weekday = calendar.day_name[datetime.date.fromisoformat(date).weekday()] + print('%s (%s)' % (date, weekday)) new_infections = [] weekly_sums = [] weekly_avgs = []
%s