comparing datetime with date

Sam Holden sholden at flexal.cs.usyd.edu.au
Wed Sep 15 02:33:09 CEST 2004


On Wed, 15 Sep 2004 09:24:03 +1000,
	Graeme Matthew <graeme.matthew at contrado.com.au> wrote:
> This is very interesting because if you continue further and coerce both to
> strings you get:
>
>>>> print str(y) == str(y)
> True

Of course if you actually do:

>>>> print str(x) == str(y)
> False


>>>> str(y)
> '2004-09-14 06:43:15'
>>>> str(x)
> '2004-09-14'
>>>>
>
> Even though there string values are different they still match?

No, they only matched becuase you compared y with y :)


-- 
Sam Holden



More information about the Python-list mailing list