Week number in Python
datetime objects own a method called
isocalendar() which returns a list containing
three ISO 8601 values: the ISO year, the ISO week number and the ISO weekday.
Get the current week number and print it.
from datetime import date weekNumber = date.today().isocalendar() print 'Week number:', weekNumber
comments powered by Disqus