How to use tzutc()

巧了我就是萌 提交于 2019-12-21 03:29:08

问题


What am I missing, how do I get this function to work?

import dateutil.parser
import datetime

my_date = datetime.datetime(2000, 1, 1, 0, 0, 0, 000000, tzinfo=tzutc())

print(my_date)

Gives me the error:

NameError: name 'tzutc' is not defined

回答1:


You did not import it:

from dateutil.tz import tzutc


来源:https://stackoverflow.com/questions/44625803/how-to-use-tzutc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!