If your lists are long, it can be worth pre-processing l2 in order to be able to use bisect to find the closest date. Then, finding the closest date to a date in l1 will be O(log(len(l2)) instead of O(len(l2)) with min.
from datetime import datetime
from bisect import bisect
l1 = [ '09/12/2017', '10/24/2017' ]
l2 = [ '09/15/2017', '10/26/2017', '12/22/2017' ]
dates = sorted(map(lambda d: datetime.strptime(d, '%m/%d/%Y'), l2))
middle_dates = [dates[i] + (dates[i+1]-dates[i])/2 for i in range(len(dates)-1)]
out = [l2[bisect(middle_dates, datetime.strptime(d,'%m/%d/%Y'))] for d in l1]
print(out)
# ['09/15/2017', '10/26/2017']
To address your last comment, here is another solution using iterators and generators, that goes over l1 and only the necessary part of the start of l2:
from datetime import datetime
from itertools import tee, islice, zip_longest
def closest_dates(l1, l2):
"""
For each date in l1, finds the closest date in l2,
assuming the lists are already sorted.
"""
dates1 = (datetime.strptime(d, '%m/%d/%Y') for d in l1)
dates2 = (datetime.strptime(d, '%m/%d/%Y') for d in l2)
dinf, dsup = tee(dates2)
enum_middles = enumerate(d1 + (d2-d1)/2
for d1, d2 in zip_longest(dinf, islice(dsup, 1, None),
fillvalue=datetime.max))
out = []
index, middle = next(enum_middles)
for d in dates1:
while d > middle:
index, middle = next(enum_middles)
out.append(l2[index])
return out
Some tests:
l1 = [ '09/12/2017', '10/24/2017', '12/11/2017', '01/04/2018' ]
l2 = [ '09/15/2017', '10/26/2017', '12/22/2017' ]
print(closest_dates(l1, l2))
# ['09/15/2017', '10/26/2017', '12/22/2017', '12/22/2017']
l2 = ['11/11/2018'] # only one date, it's always the closest
print(closest_dates(l1, l2))
# ['11/11/2018', '11/11/2018', '11/11/2018', '11/11/2018']