📌  相关文章
📜  AttributeError: type object 'datetime.datetime' 没有属性 'datetime' - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:06.020000             🧑  作者: Mango

代码示例6
>>> from datetime import datetime
>>> datetime

>>> datetime.datetime(2001,5,1) # You shouldn't expect this to work 
                                # as you imported the type, not the module
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
>>> datetime(2001,5,1)
datetime.datetime(2001, 5, 1, 0, 0)