On Tue, Dec 11, 2012 at 2:18 PM, Marc Christiansen <use...@solar-empire.de> wrote: >>>> parse('1. Januar 2013') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/usr/lib64/python3.3/site-packages/dateutil/parser.py", line 720, in > parse > return DEFAULTPARSER.parse(timestr, **kwargs) > File "/usr/lib64/python3.3/site-packages/dateutil/parser.py", line 310, in > parse > raise ValueError("unknown string format") > ValueError: unknown string format
A parserinfo class can be passed to parse() for unknown locale strings. >>>> parse('1.2.2013') # ambiguous, I know > datetime.datetime(2013, 1, 2, 0, 0) # should be datetime.datetime(2013, 2, 1, > 0, 0) In [2]: parse('1.2.2013', dayfirst=True) Out[2]: datetime.datetime(2013, 2, 1, 0, 0) -- Greg Donald -- http://mail.python.org/mailman/listinfo/python-list