Python Module To Extract Probable Dates From Strings?
I'm looking for a Python module that would take an arbitrary block of text, search it for something that looks like a date string, and build a DateTime object out of it. Something
Solution 1:
The nearest equivalent is probably the dateutil module. Usage is:
>>>from dateutil.parser import parse>>>parse("Wed, Nov 12")
datetime.datetime(2008, 11, 12, 0, 0)
Using the fuzzy parameter should ignore extraneous text. ie
>>>parse("the date was the 1st of December 2006 2:30pm", fuzzy=True)
datetime.datetime(2006, 12, 1, 14, 30)
Solution 2:
Why no give parsedatetime a try?
Post a Comment for "Python Module To Extract Probable Dates From Strings?"