Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder5.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.05; 'locale': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '>>>': 0.12; 'defined': 0.15; 'alphabetic': 0.16; 'centos': 0.16; 'val': 0.16; 'work,': 0.20; 'header:In-Reply-To:1': 0.22; '(but': 0.22; 'skip:l 30': 0.25; 'changing': 0.29; 'string': 0.29; 'unicode': 0.29; 'list': 0.30; 'however,': 0.31; 'supposed': 0.31; 'import': 0.32; 'to:addr:python-list': 0.32; 'test': 0.33; 'header:X-Complaints- To:1': 0.34; 'characters': 0.35; 'print': 0.35; 'header:User- Agent:1': 0.35; 'think': 0.36; 'else': 0.37; 'case': 0.37; 'but': 0.38; 'current': 0.38; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'where': 0.39; 'header:Mime-Version:1': 0.39; 'how': 0.39; 'whatever': 0.39; 'header:Received:5': 0.40; 'might': 0.40; 'retrieve': 0.60; 'lower': 0.63; 'candide': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Alphabetics respect to a given locale Date: Fri, 01 Apr 2011 16:16:33 -0700 References: <4d963c2b$0$1584$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: c-76-102-66-36.hsd1.ca.comcast.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 In-Reply-To: <4d963c2b$0$1584$426a34cc@news.free.fr> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1301699907 news.xs4all.nl 32470 [::ffff:82.94.164.166]:53681 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2416 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