current week / weeks in year - best practice

Diez B. Roggisch deets at
Thu Jul 31 15:58:56 CEST 2008

Aljosa Mohorovic wrote:

> i use this to find out current week and total number of weeks for
> current year:
> now =
> weeks_in_year = int(date(now.year, 12, 31).strftime("%W"))
> current_week = int(date(now.year, now.month,"%W"))
> is this the best way or is there a better way?

Instead of use, which removes a lot of


Apart from that, I think it's the way to go.


More information about the Python-list mailing list