isoweek.py 文件源码

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

项目:alexa-apple-calendar 作者: zanderxyz 项目源码 文件源码
def fromordinal(cls, ordinal):
        """Return the week corresponding to the proleptic Gregorian ordinal,
        where January 1 of year 1 starts the week with ordinal 1.
        """
        if ordinal < 1:
            raise ValueError("ordinal must be >= 1")
        return super(Week, cls).__new__(cls, *(date.fromordinal((ordinal-1) * 7 + 1).isocalendar()[:2]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号