A python-module to parse strings to time-, date-, datetime- or timedelta-objects. Which formats are accepted is configurable. The module also provides classes to use with the argparse-module for parsing command-line arguments.
Project description
A python-module to parse strings to time-, date-, datetime- or timedelta-objects. Which formats are accepted is configurable. The module also provides classes to use with the argparse-module for parsing command-line arguments.
Latest Version
The latest version of this project can be found at : http://github.com/thomst/timeparser.
Installation
Option 1 : Install via pip
pip install timeparser
Option 2 : If you have downloaded the source
python setup.py install
Documentation
How to use?
>>> import timeparser >>> >>> timeparser.parsedate('24.4.13') datetime.date(2013, 4, 24) >>> >>> timeparser.parsedate('24 Apr 2013') datetime.date(2013, 4, 24) >>> >>> timeparser.parsetime('234405') datetime.time(23, 44, 5) >>> >>> timeparser.TimeFormats.config(allow_no_sep=False) >>> timeparser.parsetime('234405') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "timeparser.py", line 398, in parsetime raise ValueError("couldn't parse %s as time" % string) ValueError: couldn't parse 234405 as time >>> >>> timeparser.parsedatetime('24-04-13_23:44:05') datetime.datetime(2013, 4, 24, 23, 44, 5)
Reporting Bugs
Please report bugs at github issue tracker: https://github.com/thomst/timeparser/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file timeparser-0.3.tar.gz
.
File metadata
- Download URL: timeparser-0.3.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948c4df55c20b524b80df338fcf6a24cf8ae13de49d90bcdf4dfef62f184a8b7 |
|
MD5 | 5239959ef9a9ca2600d943d6012612fa |
|
BLAKE2b-256 | c6706f928c41a2b861fe26f0d6854b8ff89ca9351c16c3859392591347d3b689 |