Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 IP 地理定位服务,它以以下格式返回用户估计的时区-08:00
-08:00
起初我试图将这个数字转储到 Pytz 中,但这不起作用。(我现在意识到这是一个愚蠢的想法。)
那么我如何将这个数字解析成一个 tzinfo 对象呢?
偏移量不足以定义时区,例如,它忽略 DST 和对该区域时间的其他更改。
要获得有限的 tzinfo 对象,您可以使用pytz.FixedOffset(-8*60).
pytz.FixedOffset(-8*60)