Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2416
| From | Emile van Sebille <emile@fenx.com> |
|---|---|
| Subject | Re: Alphabetics respect to a given locale |
| Date | 2011-04-01 16:16 -0700 |
| References | <4d963c2b$0$1584$426a34cc@news.free.fr> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.111.1301699907.2990.python-list@python.org> (permalink) |
On 4/1/2011 1:55 PM candide said... > How to retrieve the list of all characters defined as alphabetic for the > current locale ? I think this is supposed to work, but not for whatever reason for me when I try to test after changing my locale (but I think that's a centos thing)... import locale locale.setlocale(locale.LC_ALL,'') import string print string.lowercase I don't see where else this might be for python. However, you can test if something is alpha: >>> val = u'caf' u'\xE9' >>> val.isalpha() True >>> ... and check its unicode category >>> import unicodedata >>> unicodedata.category(u'a') 'Ll' # Letter - lower case >>> unicodedata.category(u'A') 'Lu' # Letter - upper case >>> unicodedata.category(u'1') 'Nd' # Number - decimal? >>> unicodedata.category(u'\x01') 'Cc' # HTH, Emile
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Alphabetics respect to a given locale candide <candide@free.invalid> - 2011-04-01 22:55 +0200 Re: Alphabetics respect to a given locale Emile van Sebille <emile@fenx.com> - 2011-04-01 16:16 -0700 Re: Alphabetics respect to a given locale candide <candide@free.invalid> - 2011-04-02 15:18 +0200
csiph-web