跳转到主要内容

从字符串中提取日期时间对象

项目描述

Build Status pypi downloads per day pypi version conda version

一个Python模块,用于在文本中定位日期。使用此包从文档中提取所有类型的日期字符串并将其转换为日期时间对象。

此模块找到可能的日期时间字符串,然后使用dateutil将其转换为日期时间对象。

安装

使用pip

pip install datefinder

使用conda

conda install -c conda-forge datefinder

如何使用

In [1]: string_with_dates = """
   ...: ...
   ...: entries are due by January 4th, 2017 at 8:00pm
   ...: ...
   ...: created 01/15/2005 by ACME Inc. and associates.
   ...: ...
   ...: """

In [2]: import datefinder

In [3]: matches = datefinder.find_dates(string_with_dates)

In [4]: for match in matches:
   ...:     print match
   ...:
2017-01-04 20:00:00
2005-01-15 00:00:00

演示

项目详情


下载文件

下载适用于您的平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

本版本没有可用的源分发文件。请参阅生成分发归档教程

已构建的分发

datefinder-0.7.3-py2.py3-none-any.whl (10.6 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者