Week numbers in Python
To get the current ISO 8601 week number in Python, use the following code snippet:
import datetime
# Returns ISO week number
datetime.date.today().isocalendar()[1]
* Ensure your system or application regional settings are set to follow ISO 8601 standards (weeks start on Monday) if the output varies.