(replace raw_input with input for Python 3.x)
#!/usr/bin/python import datetime FROM = raw_input("From date YYYY-MM-DD: ") TO = raw_input("To date YYYY-MM-DD: ") FROM = datetime.datetime.strptime(FROM, "%Y-%m-%d") TO = datetime.datetime.strptime(TO, "%Y-%m-%d") NOW = datetime.date.today() START = (NOW-FROM.date()).days STOP = (NOW-TO.date()).days print("al %d & ag %d" % (START, STOP-1))