Extracting datetime info from yeardatescalendar in python
Question: 
    import calendar
    calendar.Calendar().yeardatescalendar(2014)
    
    >>> [[[[datetime.date(2013, 12, 30), datetime.date(2013, 12, 31),...
    

The above code returns datetimes for calendar year 2014. However, it also
includes the last 2 days of 2013 and firs couple of days for 2015. Is there
any way I can just extract the 2014 info?


Answer: One way of doing it:

    
    
    import datetime
    def myFun(year):
         res = []
         d = datetime.datetime(year, 1, 1)
         while d.year != year +1:
                 res.append(d)
                 d = d + datetime.timedelta(days=1)
         return res
    
    >>> myFun(2014)[:2]
    [datetime.datetime(2014, 1, 1, 0, 0), datetime.datetime(2014, 1, 2, 0, 0)]
    >>> len(myFun(2014))
    365
    

