Unicode regex and Hindi language

2008-11-28 Thread Shiao
The regex below identifies words in all languages I tested, but not in Hindi: # -*- coding: utf-8 -*- import re pat = re.compile('^(\w+)$', re.U) langs = ('English', '中文', 'हिन्दी') for l in langs: m = pat.search(l.decode('utf-8')) print l, m and m.group(1) Output: English English 中文 中

Re: Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Shiao
On Nov 14, 12:30 pm, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "Mark Tolonen" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > > > > "Shiao" <[EMAIL PROTECTED]> wrote in message > >news:

Re: Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Shiao
On Nov 14, 11:27 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I'm trying to build a regex in python to identify punctuation > > characters in all the languages. Some regex implementations support an > > extended syntax \p{P} that does just that. As far as I know, python re > > doesn't. Any

Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Shiao
Hello, I'm trying to build a regex in python to identify punctuation characters in all the languages. Some regex implementations support an extended syntax \p{P} that does just that. As far as I know, python re doesn't. Any idea of a possible alternative? Apart from manually including the punctuat

Re: Logging module gives duplicate log entries

2007-08-21 Thread Shiao
Maybe my question wasn't very clear. What I meant is that these four lines lead in my case to two entries per logged event: applog = logging.getLogger() applog.setLevel(logging.DEBUG) hdl = logging.FileHandler('/tmp/foo.log') applog.addHandler(hdl) However if I REPLACE the above by: logging.basi

Re: Logging module gives duplicate log entries

2007-08-21 Thread Shiao
> > You need to remove the handler from the logging object > > # remove the handler once you are done > applog.removeHandler(hdl) > > Cheers, > amit. > I'm not sure how this could help. -- http://mail.python.org/mailman/listinfo/python-list

Logging module gives duplicate log entries

2007-08-21 Thread Shiao
Hi, I am getting duplicate log entries with the logging module. The following behaves as expected, leading to one log entry for each logged event: logging.basicConfig(level=logging.DEBUG, filename='/tmp/foo.log') But this results in two entries for each logged event: applog = logging.getLogger(