where to find win32 com <type 'time'>

news.sandia.gov jaraco at nospamsandia.gov
Wed Jan 8 13:51:18 EST 2003


I'm using the win32com extensions for Python to query a database with time columns in it.  When I get a result, I want to be able to identify if the type of the value is (specifically if it's a 'time' type).  Currently, I'm using the string returned by the representation of the type, but I'd rather use the object itself if possible.

# example
import win32com.client
conn = win32com.client.Dispatch( 'ADODB.Connection' )
conn.Open( <ODBCNAME> )
rst, res = conn.Execute( <QUERY> )
values = rst.GetRows( -1, 0, 0 )[0] # get the first column as a sequence
for value in values:
  if repr( type( value ) ) == "<type 'time'>":
    pass # do something with the time value

My motivation for doing this is I have a generic class that is responsible for manipulating the data regardless of type, but at some point it has to know the type to properly manituplate it.  I don't know how to refer to the <type 'time'> object, however to compare it with the type( value ).

Any suggestions?

Thanks,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030108/7a9c0cd3/attachment.html>


More information about the Python-list mailing list