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

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

代码示例3
>>> 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)