views.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:amadeuslms 作者: amadeusproject 项目源码 文件源码
def get_days_of_the_month(month, year = date.today().year):

    #get current year
    if year is  None:
        year = date.today().year
    mappings = {_('January'): 1, _('February'): 2, _('March'): 3, _('April'): 4, _('May'): 5, _('June'): 6, _('July'): 7
    , _('August'): 8, _('September'): 9, _('October'): 10, _('November'): 11, _('December'): 12}

    c = calendar.Calendar()
    days = c.itermonthdays(int(year), mappings[_(month)])
    days_set = set()
    for day in days:
        days_set.add(day)

    days_set.remove(0) #because 0 is not aan actual day from that month
    return days_set
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号