title: How to find all week numbers that are first week of month in a year python
body: <p>I want to create a event that falls on Sunday of every first week of months.</p>
  
  <p>This is what I am doing for a particular week number which is first week of <code>june</code> to get date:</p>
  
  <pre><code>from datetime import datetime
  myDate = "2017 22 0"
  # here `2017` is year, `22` is week number and `0` =sunday is week day
  datetime.strptime(myDate, "%Y %W %w")
  
  #output...
  datetime.datetime(2017, 6, 4, 0, 0)
  </code></pre>
  
  <p>So I need a list of all week numbers that are first week of month so I can loop on it and get desire dates.</p>
  
  <p><strong>Adding More information</strong></p>
  
  <p>I want a method which return list of week numbers which are first week of month where first week means week has first sunday.</p>
  
  <pre><code>def get_week_number(year=2017, day=0):
     #day 0 means sunday
     ...
     ...
     return [1, 5, 9, 13, 18, 22, ...]  
  </code></pre>