schizophrenic view of what is white space

Robin Becker robin at reportlab.com
Thu Dec 4 12:19:43 EST 2008


Jean-Paul Calderone wrote:
.........
> 
> You have to give the re module an additional hint that you care about
> unicode:
> 
>  exarkun at charm:~$ python
>  Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)  [GCC 4.2.3 (Ubuntu 
> 4.2.3-2ubuntu7)] on linux2
>  Type "help", "copyright", "credits" or "license" for more information.
>  >>> import re
>  >>> print re.compile(r'\s').search(u'a\xa0b')
>  None
>  >>> print re.compile(r'\s', re.U).search(u'a\xa0b')
>  <_sre.SRE_Match object at 0xb7dbb3a0>
>  >>>
> 
> Jean-Paul
.......

so the default behaviour differs for unicode and re working on unicode. I 
suppose that won't be true in Python 3.
-- 
Robin Becker




More information about the Python-list mailing list