Jul 05, 2007 02:01
Программа:
zowers@zml:~/projects$ cat birthday.py
#!/usr/bin/env python
import datetime
import time
import locale
def print_days( start_date, second_date ):
delta = second_date - start_date
locale.setlocale( locale.LC_ALL, "" )
print "start_date: %s" % time.strftime( "%x", start_date.timetuple() )
print "second_date: %s" % time.strftime( "%x", second_date.timetuple() )
print "days: %i" % delta.days
START_DATE = datetime.date( 1979, 07, 05 )
SECOND_DATE = datetime.date( 2007, 07, 05 )
print_days( START_DATE, SECOND_DATE )
Вывод:
zowers@zml:~/projects$ ./birthday.py
start_date: 05.07.1979
second_date: 05.07.2007
days: 10227
tech,
python,
life,
holidays