Why does the "".join(r) do this?

Skip Montanaro skip at pobox.com
Thu May 20 12:29:19 EDT 2004


    Peter> Skip Montanaro wrote:
    >> Try
    >> 
    >> u"".join(r)
    >> 
    >> instead.  I think the join operation is trying to convert the Unicode bits
    >> in your list of strings to strings by encoding using the default codec,
    >> which appears to be ASCII.

    Peter> This is bound to fail when the first non-ascii str occurs:

    ...

Yeah I realized that later.  I missed that he was appending non-ASCII
strings to his list.  I thought he was only appending unicode objects and
ASCII strings (in which case what he was trying should have worked).  Serves
me right for trying to respond with a head cold.

Skip




More information about the Python-list mailing list