Le mercredi 17 octobre 2012 19:07:43 UTC+2, Ian a écrit : > On Wed, Oct 17, 2012 at 9:32 AM, <wxjmfa...@gmail.com> wrote: > > >>>> import unicodedata > > >>>> def HasDiacritics(w): > > > ... w_decomposed = unicodedata.normalize('NFKD', w) > > > ... return 'no' if len(w) == len(w_decomposed) else 'yes' > > > ... > > >>>> HasDiacritics('éléphant') > > > 'yes' > > >>>> HasDiacritics('elephant') > > > 'no' > > >>>> HasDiacritics('\N{LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON}') > > > 'yes' > > >>>> HasDiacritics('U') > > > 'no' > > > > Is there something wrong with True and False that you had to replace > > them with strings? > > > > "return len(w) != len(w_decomposed)" is all you need.
Not at all, I knew this. In this I decided to program like this. Do you get it? Yes/No or True/False jmf -- http://mail.python.org/mailman/listinfo/python-list