compare types?

Kenneth Godee Ken at perfect-image.com
Tue Dec 31 02:03:25 EST 2002


I'm trying to iterate thru a tuple and find 
any DateTime objects.....

print type(item)
returns....
<type 'DateTime'>

So I thought I could....

if type(item) == 'DateTime': (or many other variations I tried)
just can't seem to get a match

The only way I found to match is like this...

if type(item) == type(DateTime.now()):

I understand why the above types match
it just seems like there should be a easier
way to compare a DateTime type?
Or is this the way it should be done?






More information about the Python-list mailing list