Palindromic ISO dates between two years with #Python


import sys
from datetime import datetime
from itertools import chain

def palinDay(y):
s = str(y)
r = s[::-1]
iso = '-'.join([s, r[0:2], r[2:]])
datetime.strptime(iso, '%Y-%m-%d')
return [iso]
except ValueError:
return []

palinDates = list(chain.from_iterable(
map(palinDay, range(int(sys.argv[1]),int(sys.argv[2])))
for x in [

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s