0
我從包括日期在內的Excel中拉出一個範圍。如果我檢查的類型,這是我所得到的:如何使用isinstance測試pywintypes.datetime類型?
type(q)
Out[45]:
pywintypes.datetime
q
Out[46]:
pywintypes.datetime(2009, 10, 26, 0, 0, tzinfo=TimeZoneInfo('GMT Standard Time', True))
我使用isinstance(q, pywintypes.datetime)
做就可以了檢查,但它不工作。
isinstance(q, pywintypes.datetime)
Traceback (most recent call last):
File "C:\Anaconda2\envs\py36\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-47-916010697275>", line 1, in <module>
isinstance(q, pywintypes.datetime)
AttributeError: module 'pywintypes' has no attribute 'datetime'
任何想法如何通過isinstance測試以檢查它是否是一個pywintypes對象?
感謝
這是行不通的 –