write_build_date_header.py 文件源码

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

项目:gn_build 作者: realcome 项目源码 文件源码
def GetFirstSundayOfMonth(year, month):
  """Returns the first sunday of the given month of the given year.

  >>> GetFirstSundayOfMonth(2016, 2)
  7
  >>> GetFirstSundayOfMonth(2016, 3)
  6
  >>> GetFirstSundayOfMonth(2000, 1)
  2
  """
  weeks = calendar.Calendar().monthdays2calendar(year, month)
  # Return the first day in the first week that is a Sunday.
  return [date_day[0] for date_day in weeks[0] if date_day[1] == 6][0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号