在Python中分析日期/时间字符串时区缩写名称? [英] Parsing date/time string with timezone abbreviated name in Python?
本文介绍了在Python中分析日期/时间字符串时区缩写名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Python中解析时间戳字符串,如Sat,11/01/09 8:00 PM EST
,但是我无法找到解决方案这将处理缩写的时区。
I'm trying to parse timestamp strings like "Sat, 11/01/09 8:00PM EST"
in Python, but I'm having trouble finding a solution that will handle the abbreviated timezone.
我正在使用 dateutil
的 parse()
函数,但不解析时区。有没有办法做到这一点?
I'm using dateutil
's parse()
function, but it doesn't parse the timezone. Is there an easy way to do this?
推荐答案
这可能不会工作,因为这些缩写不是唯一的。有关详细信息,请参见此页面。如果您使用一组已知的输入,您可能会自动手动处理。
That probably won't work because those abbreviations aren't unique. See this page for details. You might wind up just having to manually handle it yourself if you're working with a known set of inputs.
这篇关于在Python中分析日期/时间字符串时区缩写名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文