"week-year" conversion to date

Rune Strand rune.strand at gmail.com
Wed Sep 14 09:58:48 EDT 2005


year = '2005'
week = 50
weekday = 1 # Monday is 1

time_expr = '%s, %s, %s' % (year, week, weekday)
time_struct = time.strptime(time_expr, "%Y, %W, %w")
print time.strftime("%Y%m%d", time_struct)

But the datetime module may have an easier way




More information about the Python-list mailing list