The zoneinfo
module provides the available_timezones()
function to get a set of all of the available time zones present in your system’s IANA
database.
ZoneInfo( key )
constructor.Note: The
zoneinfo
module is only available in Python version 3.9 or higher.
zoneinfo.available_timezones()
This function does not accept any parameters.
The function returns a set of available time zones in the IANA
database.
In the example below, we:
zoneinfo
.zoneinfo.available_timezones()
and print out the timezones.import zoneinfofor key in zoneinfo.available_timezones():print(key)