washakie wrote: > Hello, > > I have a list of datetime objects: DTlist, I have another single datetime > object: dt, ... I need to find the nearest DTlist[i] to the dt .... is > there a simple way to do this? There isn't necessarily an exact match... > > Thanks! > .john >
min(DTlist,key=lambda date : abs(dt-date)) -- http://mail.python.org/mailman/listinfo/python-list