[Tutor] Is there a method like this already?

John Fouhy john at fouhy.net
Tue Jul 25 01:20:32 CEST 2006


On 25/07/06, Nathan Pinno <falcon3166 at hotmail.com> wrote:
>
> Is there a method in Python like this already:
>
> [code]
> #This program calculates how many days it has been from one day to the
> other.

Have a look at the datetime module: if date1 and date2 are both
datetime.date instances, then (date1-date2) is a datetime.timedelta,
and (date1-date2).days is the number of days in the timedelta.

Reading the documentation helps!

-- 
John.


More information about the Tutor mailing list