如何使用tzutc()

Ami*_*off 14 python timezone datetime

我错过了什么,如何让这个功能起作用?

import dateutil.parser
import datetime

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

print(my_date)
Run Code Online (Sandbox Code Playgroud)

给我错误:

NameError: name 'tzutc' is not defined
Run Code Online (Sandbox Code Playgroud)

小智 32

你没有导入它:

from dateutil.tz import tzutc
Run Code Online (Sandbox Code Playgroud)