Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to convert month to number in python

import calendar

months = {month: index for index, month in enumerate(calendar.month_abbr) if month}

# {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
 
PREVIOUS NEXT
Tagged: #convert #month #number #python
ADD COMMENT
Topic
Name
9+2 =