a python puzzle

Terry Reedy tjreedy at udel.edu
Fri Sep 27 08:48:55 EDT 2002


"David Brown" <david at no.westcontrol.spam.com> wrote in message
news:an1i31$1r3$1 at news.netpower.no...
> I'm not too interested in the crypogram puzzle, but your solution
here has
> just given me a solution to something that has been bugging me for
some
> time - finding an easy way to convert a list of characters into a
string:
>
> >>> a = "Hello"
> >>> b = [x for x in a]

or
>>> list(a)
['H', 'e', 'l', 'l', 'o']
which is probably faster

> >>> "".join(b)
> 'Hello'





More information about the Python-list mailing list