是否有 Pytz 时区列表? [英] Is there a list of Pytz Timezones?

查看:27
本文介绍了是否有 Pytz 时区列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 Python 库 pytz 中时区参数的所有可能值是什么.怎么做?

I would like to know what are all the possible values for the timezone argument in the Python library pytz. How to do it?

推荐答案

您可以使用 pytz.all_timezones 列出所有可用的时区:

You can list all the available timezones with pytz.all_timezones:

In [40]: import pytz
In [41]: pytz.all_timezones
Out[42]: 
['Africa/Abidjan',
 'Africa/Accra',
 'Africa/Addis_Ababa',
 ...]

还有pytz.common_timezones:

In [45]: len(pytz.common_timezones)
Out[45]: 403

In [46]: len(pytz.all_timezones)
Out[46]: 563

这篇关于是否有 Pytz 时区列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆