Hendrik van Rooyen schrieb:
One can go from lb = ['b','a','n','a','n','a']
to s = "banana" by using s = "".join(lb)

Is there a way to go the reverse route?

I have not been able to find one.

It is obviously easy to write a for char in s loop
or list comprehension, but there seems to be
no function or string method to return a list
of characters.

using lb = s.split("") would have been nice
as a complement to s = "".join(lb).

Split is already full of magic, it could do with more.


I think

lb = list(s)

is good enough.

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to