Thats for all the responses. I'm going to use Kents method. I'll let you know what I work out.<div><br><div>Rudiger - I did think about that. Luckily I am generating the list with a start datetime and end datetime so if those don't exist </div>
<div>in either end if the list I can insert them after I check the dates between.</div></div>
<br><br><div class="gmail_quote">On Fri, Oct 9, 2009 at 5:11 PM, Rüdiger Wolf <span dir="ltr"><<a href="mailto:rudiger.wolf@throughputfocus.com">rudiger.wolf@throughputfocus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Ah! but are we sure that the max and min dates are actually in the list?<br>
If there are 'missing dates' it might just be possible that it is the<br>
max or min date that is missing.<br>
<div><div></div><div class="h5"><br>
On Fri, 09 Oct 2009 16:43 -0400, "Kent Johnson" <<a href="mailto:kent37@tds.net">kent37@tds.net</a>> wrote:<br>
> On Fri, Oct 9, 2009 at 3:16 PM, Glen Zangirolami <<a href="mailto:digitalman66@gmail.com">digitalman66@gmail.com</a>><br>
> wrote:<br>
> > If i have a list of dates:<br>
> > date_list =<br>
> > ['2008-12-29','2008-12-31','2008-01-01','2008-01-02','2008-01-03','2008-01-05']<br>
> > How do I find the missing dates in the range of dates and insert them into<br>
> > the list so I get?<br>
> > date_list =<br>
> > ['2008-12-29','2008-12-30','2008-12-31','2008-01-01','2008-01-02','2008-01-03','2008-12-04','2008-01-05']<br>
><br>
> I would do something like the following using datetime.datetime and<br>
> datetime.timedelta:<br>
> - convert each list item to a datetime object using datetime.strptime()<br>
> - find the min and max datetimes in the list (use min() and max()<br>
> - create a new list by incrementing the min date by timedelta(days=1)<br>
> until it hits the max date<br>
> - convert the new list to strings using datetime.strftime()<br>
><br>
> Kent<br>
<br>
</div></div></blockquote></div><br>