首页 > 解决方案 > 错误:UnknownTimezoneWarning:tzname IST 已识别但无法理解

问题描述

Error :  UnknownTimezoneWarning: tzname IST identified but not understood.  Pass `tzinfos` argument in order to correctly return a timezone-aware datetime.  In a future version, this will raise an exception.
  category=UnknownTimezoneWarning)

我正在使用datefinder从字符串中获取日期。

这是一个示例代码:

import datefinder

a =  'Last Updated :16th July 2020 18:00 IST'
matches = list(datefinder.find_dates(a, source = True ))
print (matches)

输出 :

UnknownTimezoneWarning: tzname IST identified but not understood.  Pass `tzinfos` argument in order to correctly return a timezone-aware datetime.  In a future version, this will raise an exception.
  category=UnknownTimezoneWarning)
[(datetime.datetime(2020, 7, 16, 18, 0), '16th July 2020 18:00 IST')]

如何消除上述错误?(在字符串“a”中使用 UTC 代替 IST(印度标准时间)时效果很好)

标签: pythondatefinder

解决方案


推荐阅读