number of weeks in a given month python
<p>I'm trying to get the number of weeks in any month. for example:</p>

<p><code>for this month August 2016, the days of the month streches over 5 weeks. while for October 2016 the number of weeks are 6</code>. </p>

<p>Is there any elegant way to find out this number? tried using calendar and datetime but I couldn't find anything that can help me solve my problem.</p>

<blockquote>
  <p>P.S I'm using python 2.6</p>
</blockquote>

<p>Thanks in advance!</p>

<p>First thing that comes to mind: get the week number for the first day of the month, and the week number of the last day of the month. The number of weeks strechted by the month is then the difference of the week numbers.</p>

<p>To get the week number for a date: <a href="http://stackoverflow.com/questions/2600775/how-to-get-week-number-in-python">How to get week number in Python?</a></p>

python calendar