From: Fabio Zadrozny on
I'm trying to get the locale-aware date format but it doesn't seem to
be available through nl_langinfo in python 2.5.4 (windows vista).

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] onType "help", "copyright", "credits" or "license" for more
information.
>>> import locale;locale.nl_langinfo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'nl_langinfo'


Is that what I should be using? Is there any other way for getting that info?

Thanks,

Fabio


>>> print '\n'.join(sorted(dir(locale)))
CHAR_MAX
Error
LC_ALL
LC_COLLATE
LC_CTYPE
LC_MONETARY
LC_NUMERIC
LC_TIME
__all__
__builtins__
__doc__
__file__
__name__
_build_localename
_group
_parse_localename
_percent_re
_print_locale
_setlocale
_test
atof
atoi
currency
encodings
format
format_string
getdefaultlocale
getlocale
getpreferredencoding
locale_alias
locale_encoding_alias
localeconv
normalize
operator
re
resetlocale
setlocale
str
strcoll
strxfrm
sys
windows_locale
>>>
From: Chris Rebert on
On Fri, Jun 25, 2010 at 4:39 AM, Fabio Zadrozny <fabiofz(a)gmail.com> wrote:
> I'm trying to get the locale-aware date format but it doesn't seem to
> be available through nl_langinfo in python 2.5.4 (windows vista).

There is the %x format specifier in the time module, but it doesn't
actually tell you the format, it merely parses/outputs data in that
format; thus, it's rather opaque.
http://docs.python.org/library/time.html#time.strftime

Cheers,
Chris
--
http://blog.rebertia.com