Alphabetics respect to a given locale
eryksun ()
eryksun at gmail.com
Fri Apr 1 19:08:47 EDT 2011
On Friday, April 1, 2011 4:55:42 PM UTC-4, candide wrote:
>
> How to retrieve the list of all characters defined as alphabetic for the
> current locale ?
Give this a shot:
In [1]: import string
In [2]: print string.letters
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
In [3]: import locale
In [4]: locale.getlocale()
Out[4]: (None, None)
In [5]: locale.setlocale(locale.LC_ALL, 'English_Great Britain')
Out[5]: 'English_United Kingdom.1252'
In [6]: print string.letters
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
ƒSOZsozYªµºAAAAÄÅÆÇEÉEEIIIIDÑOOOOÖOUUUÜY_
ßàáâaäåæçèéêëìíîïdñòóôoöoùúûüy_ÿ
The strings for locales are different for POSIX vs Windows systems.
http://docs.python.org/library/locale.html
More information about the Python-list
mailing list