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

John Roth newsgroups at jhrothjr.com
Thu May 20 14:56:57 EDT 2004


"Ivan Voras" <ivoras at __geri.cc.fer.hr> wrote in message
news:c8itrm$epg$1 at bagan.srce.hr...
> Peter Otten wrote:
>
> > 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.
> >
> >
> > This is bound to fail when the first non-ascii str occurs:
>
> Is there a way to change the default codec in a part of a program?
> (Meaning that different parts of program deal with strings they know are
> in a specific different code pages?)

Does the encoding line (1st or second line of program) do this?
I don't remember if it does or not - although I'd suspect not.
Otherwise it seems like a reasonably straightforward function
to write.

John Roth
>
>
> -- 
> C isn't that hard: void (*(*f[])())() defines f as an array of
> unspecified size, of pointers to functions that return pointers to
> functions that return void.





More information about the Python-list mailing list