【发布时间】:2019-12-11 12:08:13
【问题描述】:
我尝试使用时区信息设置日期时间。在这种情况下是 UTC。
当我尝试这段代码时,它可以工作:
from datetime import datetime, timezone
prueba = timezone.utc
fecha = datetime(1900, 1, 1, 1, 00, 00, 00000, tzinfo=prueba)
但是当我尝试这个时,它会出现“TypeError: 'module' object is not callable”的错误
import datetime
prueba = datetime.timezone.utc
fecha = datetime(1900, 1, 1, 1, 00, 00, 00000, tzinfo=prueba)
这对我来说没有意义,因为我指的是同一个班级。
【问题讨论】:
标签: python python-3.x typeerror python-import python-datetime