split on NO-BREAK SPACE

Peter Kleiweg p.c.j.kleiweg at rug.nl
Sun Jul 22 11:15:26 EDT 2007


Is this a bug or a feature?


    Python 2.4.4 (#1, Oct 19 2006, 11:55:22) 
    [GCC 2.95.3 20010315 (SuSE)] on linux2

    >>> a = 'a b c\240d e'
    >>> a
    'a b c\xa0d e'
    >>> a.split()
    ['a', 'b', 'c\xa0d', 'e']
    >>> a = a.decode('latin-1')
    >>> a
    u'a b c\xa0d e'
    >>> a.split()
    [u'a', u'b', u'c', u'd', u'e']



-- 
Peter Kleiweg  L:NL,af,da,de,en,ia,nds,no,sv,(fr,it)  S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/kleiweg/ls.html



More information about the Python-list mailing list