Converting DD MM YYYY into YYYY-MM-DD?
Gilles Ganault
nospam at nospam.com
Tue Aug 18 04:19:53 EDT 2009
On Tue, 18 Aug 2009 01:11:20 -0700, Rami Chowdhury
<rami.chowdhury at gmail.com> wrote:
>Could you let me know which platform this is on (Windows, *nix)? It may be a
>locale encoding issue -- the locale.setlocale() function allows the second
>argument to be a tuple of (locale_code, encoding), as below:
>
>locale.setlocale(locale.LC_ALL, ('FR', 'UTF-8'))
It's on XP, and I'm using ActivePython 2.5.1.1.
http://www.activestate.com/activepython/
Python doesn't like the above:
#locale.Error: unsupported locale setting
locale.setlocale(locale.LC_ALL, ('FR', 'UTF-8'))
Maybe it was introduced in more recent versions of Python?
>Since this is for a one-shot (and presumably threading-agnostic) program, and
>a fairly trivially formatted date-string, I would suggest using
>datetime.strptime
>(http://docs.python.org/library/datetime.html#datetime.datetime.strptime) and
>not regular expressions (which IIRC have Issues with non-ASCII characters).
If the regex library can only handle basic latin characters, I'll wait
until a script I'm running is done, and I'll upgrade to the 2.6.2.2 to
see how it goes.
Thank you.
More information about the Python-list
mailing list