I've got a list of dates (datetimes):
>>> print str(range)
[datetime.datetime(2011, 12, 15, 0, 0), datetime.datetime(2011, 12, 16, 0, 0), datetime.datetime(2011, 12, 17, 0, 0)]
and I'd like to format them as "%d/%m/%Y" and comma separate them, ie:
15/12/2011, 16/12/2011, 17/12/2011
At the moment I'm using map to run strftime on each of the dates like so:
>>> string = ", ".join(map(lambda x: x.strftime("%d/%m/%Y"), range))
>>> print string
which outputs:
15/12/2011, 16/12/2011, 17/12/2011
Ta dah!
It's not the easiest to read, but it works. Is it efficient? Is it pythonic? (does that matter?)